Logo Search packages:      
Sourcecode: zope-attachmentfield version File versions  Download package

def AttachmentField::AttachmentField::AttachmentField::getFilename (   self,
  instance,
  fromBaseUnit = True 
)

getFilename(self, instance, ) => return the filename
We split to return only a file name and not a whole path.

Definition at line 147 of file AttachmentField.py.

00147                                                       :
        """
        getFilename(self, instance, ) => return the filename
        We split to return only a file name and not a whole path.
        """

        # Get object or data
        accessor = self.getAccessor(instance)

        if self.isEmpty(instance) or accessor is None:
            return ''

        obj = accessor()
        fn = ''

        if hasattr(obj.aq_explicit, 'filename'):
            fn = obj.filename
        elif hasattr(obj.aq_explicit, 'getFilename'):
            fn = obj.getFilename()
        else:
            fn = Field.FileField.getFilename(self, instance, fromBaseUnit)

        fn = string.split(fn, '/')[-1]
        fn = string.split(fn, '\\')[-1]
        return fn

    def guessMimeTypeFromContent(self, instance, ):


Generated by  Doxygen 1.6.0   Back to index