Author: jmorliaguet
Date: Fri Oct 14 00:39:54 2005
New Revision: 28284

Modified:
   z3lab/cpsskins/branches/jmo-perspectives/configuration/meta.zcml
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/perspectives/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/interfaces.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py
Log:

- added support for both site perspectives (persistent) and application
  perspectives (declared in zcml)



Modified: z3lab/cpsskins/branches/jmo-perspectives/configuration/meta.zcml
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/meta.zcml    
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/meta.zcml    Fri Oct 
14 00:39:54 2005
@@ -14,4 +14,6 @@
 
   <include package=".widgets" file="meta.zcml" />
 
+  <include package=".perspectives" file="meta.zcml" />
+
 </configure>

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/perspectives/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/perspectives/__init__.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/perspectives/__init__.py 
    Fri Oct 14 00:39:54 2005
@@ -16,6 +16,4 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
-# make this directory a package
 
-pass

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/__init__.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/__init__.py  
Fri Oct 14 00:39:54 2005
@@ -23,7 +23,7 @@
 from cpsskins.elements import Element
 from interfaces import IPerspective, ISitePerspective
 
-class Perspective(Element):
+class Perspective(object):
     """A perspective
 
     >>> perspective = Perspective('Some perspective')
@@ -34,7 +34,6 @@
     implements(IPerspective)
 
     def __init__(self, perspective=''):
-        Element.__init__(self)
         self._perspective = perspective
 
     def __repr__(self):

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/interfaces.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/interfaces.py    
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/elements/perspectives/interfaces.py    
    Fri Oct 14 00:39:54 2005
@@ -17,11 +17,16 @@
 """
 __docformat__ = "reStructuredText"
 
+from zope.interface import Interface
+
 from cpsskins.elements.interfaces import IElement
 
-class IPerspective(IElement):
+class IPerspective(Interface):
     """A perspective."""
 
+    def __str__(self):
+        """Return the name of the perspective"""
+
 class ISitePerspective(IPerspective):
     """A perspective."""
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py  (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py  Fri Oct 14 
00:39:54 2005
@@ -18,15 +18,17 @@
 __docformat__ = "reStructuredText"
 
 from zope.app.container.interfaces import INameChooser
+from zope.component import adapts, getUtility, getUtilitiesFor
 from zope.interface import implements
 
+from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.elements import InnerNode
+from cpsskins.elements.perspectives.interfaces import IPerspective
 from cpsskins.storage.interfaces import IPerspectiveStorage
 from cpsskins.thememanager import getThemeManager
 from interfaces import ITheme, IThemePage
 from interfaces import IPageContainer
 
-
 class Theme(InnerNode):
     """Theme
 
@@ -96,11 +98,10 @@
 
     def getPerspectiveById(self, id):
         perspectives = self.getStorage(IPerspectiveStorage)
-        # XXX for testing
         for p in perspectives.values():
             if str(p) == id:
                 return p
-        return None
+        return getUtility(IPerspective, id)
 
     def addPerspective(self, object):
         """Add a perspective to the perspective storage
@@ -112,4 +113,5 @@
 
     def listPerspectives(self):
         perspectives = self.getStorage(IPerspectiveStorage)
-        return [str(p) for p in perspectives.values()]
+        return [str(p) for p in perspectives.values()] \
+             + [p[0] for p in list(getUtilitiesFor(IPerspective))]
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to