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

def CPSSkins::PortalTheme::PortalTheme::addPortalImage (   self,
  kw 
)

Add a Portal Image.

Definition at line 732 of file PortalTheme.py.

00732                                   :
        """
        Add a Portal Image.
        """
        imagecat = kw.get('imagecat', '')
        if imagecat not in self.cpsskins_listImageCategories():
            return None

        images_dir = getattr(self, imagecat, None)
        if images_dir is None:
            return None

        file = kw.get('file', None)
        fn = file.filename
        if not fn:
            return None

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

        ids = images_dir.objectIds()
        prefix = title.split('.')[0]
        if imagecat == 'thumbnails':
            ext = THUMBNAIL_IMAGE_FORMAT
        else:
            ext = title.split('.')[1]

        i = 0
        while 1:
            i = i + 1
            if ids is None:
                break
            if id not in ids:
                break
            id = prefix + str(i) + '.' + ext

        title = id
        images_dir.manage_addProduct['OFSP'].manage_addImage(
            id=id,
            file=file,
            title=title)
        img = getattr(images_dir.aq_inner.aq_explicit, id, None)
        return img

    security.declareProtected(ManageThemes, 'editPortalImage')
    def editPortalImage(self, **kw):


Generated by  Doxygen 1.6.0   Back to index