[CMF-checkins] CVS: CMF/CMFCore - SkinsContainer.py:1.8 SkinsTool.py:1.28

Yvo Schubbe y.2004_ at wcm-solutions.de
Thu Feb 5 07:52:30 EST 2004


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv7121/CMFCore

Modified Files:
	SkinsContainer.py SkinsTool.py 
Log Message:
- synced SkinsTool, SkinsContainer and their interfaces so they have the same permissions and docstrings
- replaced 'Not implemented' by NotImplementedError


=== CMF/CMFCore/SkinsContainer.py 1.7 => 1.8 ===
--- CMF/CMFCore/SkinsContainer.py:1.7	Fri Nov 28 09:52:00 2003
+++ CMF/CMFCore/SkinsContainer.py	Thu Feb  5 07:51:59 2004
@@ -19,6 +19,9 @@
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
 
+from CMFCorePermissions import AccessContentsInformation
+from interfaces.portal_skins import SkinsContainer as ISkinsContainer
+
 
 class SkinPathError (Exception):
     'Invalid skin path'
@@ -26,35 +29,33 @@
 
 
 class SkinsContainer:
+
+    __implements__ = ISkinsContainer
+
     security = ClassSecurityInfo()
 
-    security.declarePublic('getSkinPath')
+    security.declareProtected(AccessContentsInformation, 'getSkinPath')
     def getSkinPath(self, name):
-        '''
-        Converts a skin name to a skin path.
-        '''
-        raise 'Not implemented'
+        """ Convert a skin name to a skin path.
+        """
+        raise NotImplementedError
 
-    security.declarePublic('getDefaultSkin')
+    security.declareProtected(AccessContentsInformation, 'getDefaultSkin')
     def getDefaultSkin(self):
-        '''
-        Returns the default skin name.
-        '''
-        raise 'Not implemented'
+        """ Get the default skin name.
+        """
+        raise NotImplementedError
 
-    security.declarePublic('getRequestVarname')
+    security.declareProtected(AccessContentsInformation, 'getRequestVarname')
     def getRequestVarname(self):
-        '''
-        Returns the variable name to look for in the REQUEST.
-        '''
-        raise 'Not implemented'
+        """ Get the variable name to look for in the REQUEST.
+        """
+        raise NotImplementedError
 
     security.declarePrivate('getSkinByPath')
     def getSkinByPath(self, path, raise_exc=0):
-        '''
-        Returns a skin at the given path.  A skin path is of the format:
-        "some/path, some/other/path, ..."  The first part has precedence.
-        '''
+        """ Get a skin at the given path.
+        """
         baseself = aq_base(self)
         skinob = baseself
         parts = list( path.split(',') )
@@ -87,6 +88,8 @@
 
     security.declarePrivate('getSkinByName')
     def getSkinByName(self, name):
+        """ Get the named skin.
+        """
         path = self.getSkinPath(name)
         if path is None:
             return None


=== CMF/CMFCore/SkinsTool.py 1.27 => 1.28 ===
--- CMF/CMFCore/SkinsTool.py:1.27	Wed Dec 24 05:46:04 2003
+++ CMF/CMFCore/SkinsTool.py	Thu Feb  5 07:51:59 2004
@@ -20,7 +20,6 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from Globals import PersistentMapping
-from SkinsContainer import SkinsContainer
 from Acquisition import aq_base
 from DateTime import DateTime
 from AccessControl import ClassSecurityInfo
@@ -36,6 +35,7 @@
 from CMFCorePermissions import ManagePortal
 from CMFCorePermissions import View
 from interfaces.portal_skins import portal_skins as ISkinsTool
+from SkinsContainer import SkinsContainer
 from utils import _dtmldir
 from utils import getToolByName
 from utils import UniqueObject
@@ -53,11 +53,13 @@
                   'action':'manage_propertiesForm'}]
     return tuple(rval)
 
+
 class SkinsTool(UniqueObject, SkinsContainer, Folder, ActionProviderBase):
     """ This tool is used to supply skins to a portal.
     """
 
-    __implements__ = (ISkinsTool, ActionProviderBase.__implements__)
+    __implements__ = (ISkinsTool, SkinsContainer.__implements__,
+                      ActionProviderBase.__implements__)
 
     id = 'portal_skins'
     meta_type = 'CMF Skins Tool'
@@ -184,13 +186,12 @@
         self.getSkinByPath(p, raise_exc=1)
 
     #
-    #   'portal_skins' interface methods
+    #   'SkinsContainer' interface methods
     #
     security.declareProtected(AccessContentsInformation, 'getSkinPath')
     def getSkinPath(self, name):
-        '''
-        Converts a skin name to a skin path.  Used by SkinsContainer.
-        '''
+        """ Convert a skin name to a skin path.
+        """
         sels = self._getSelections()
         p = sels.get(name, None)
         if p is None:
@@ -200,19 +201,19 @@
 
     security.declareProtected(AccessContentsInformation, 'getDefaultSkin')
     def getDefaultSkin(self):
-        '''
-        Returns the default skin name.  Used by SkinsContainer.
-        '''
+        """ Get the default skin name.
+        """
         return self.default_skin
 
     security.declareProtected(AccessContentsInformation, 'getRequestVarname')
     def getRequestVarname(self):
-        '''
-        Returns the variable name to look for in the REQUEST.  Used by
-        SkinsContainer.
-        '''
+        """ Get the variable name to look for in the REQUEST.
+        """
         return self.request_varname
 
+    #
+    #   UI methods
+    #
     security.declareProtected(AccessContentsInformation, 'getAllowAny')
     def getAllowAny(self):
         '''
@@ -242,11 +243,13 @@
         rval.sort()
         return rval
 
+    #
+    #   'portal_skins' interface methods
+    #
     security.declarePublic('getSkinSelections')
     def getSkinSelections(self):
-        '''
-        Returns the sorted list of available skin names.
-        '''
+        """ Get the sorted list of available skin names.
+        """
         sels = self._getSelections()
         rval = list(sels.keys())
         rval.sort()




More information about the CMF-checkins mailing list