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

def CPSSkins::PortalTheme::PortalTheme::addPortalPalette (   self,

Add a Portal Palette. Returns the Portal Palette's id

Definition at line 650 of file PortalTheme.py.

00650                                     :
        """Add a Portal Palette. Returns the Portal Palette's id

        type_name = kw.get('type_name', None)
        if type_name is None:
            return None
        type = string.replace(type_name, ' ', '')

        title = kw.get('title', type)
        value = kw.get('value', None)

        del kw['type_name']
        if kw.has_key('title'):
            del kw['title']
        if kw.has_key('value'):
            del kw['value']

        palettes_dir = self.getPalettesFolder()
        if palettes_dir is None:
            return None

        titles = [getattr(obj, 'title', None) \
                  for obj in palettes_dir.objectValues()]

        i = 0
        while 1:
            if title not in titles:
            i = i + 1
            title = type + str(i)
            if titles is None:

        id = getFreeId(self)
        palettes_dir.invokeFactory(type_name, id, title=title, **kw)
        palette = getattr(palettes_dir.aq_inner.aq_explicit, id, None)
        if palette is not None:
            if value:
                setattr(palette, 'value', value)
            return palette
        return None

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

Generated by  Doxygen 1.6.0   Back to index