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

def CPSSkins::PortalThemesTool::PortalThemesTool::getLocalThemesAncestor (   self,
  context = None 
)

Return the first ancestor folder in a given context
   in which local themes are defined.

Definition at line 654 of file PortalThemesTool.py.

00654                                                   :
        """Return the first ancestor folder in a given context
           in which local themes are defined.
        """

        if context is None:
            return None

        local_theme_id = self.getLocalThemeID()
        # nothing is acquired
        if getattr(context, local_theme_id, None) is None:
            return None
        # we want an ancestor
        if context.hasProperty(local_theme_id):
            return None

        container = context
        while 1:
            try:
                container = aq_parent(aq_inner(container))
            except AttributeError:
                break
            # check for an object in the container
            try:
                container_ids = container.objectIds()
            except AttributeError:
                pass
            else:
                if local_theme_id in container_ids:
                    return container
            # check for a property of the container
            try:
                prop = container.hasProperty(local_theme_id)
            except AttributeError:
                pass
            else:
                if prop:
                    return container
        return None

    #
    # Theme and page negociation


Generated by  Doxygen 1.6.0   Back to index