Author: jmorliaguet
Date: Tue Dec  6 22:41:19 2005
New Revision: 1972

Added:
   cpsskins/branches/jmo-perspectives/configuration/settings/
   cpsskins/branches/jmo-perspectives/configuration/settings/__init__.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/settings/configure.zcml   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/settings/meta.zcml   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/settings/metaconfigure.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/settings/metadirectives.py  
 (contents, props changed)
   cpsskins/branches/jmo-perspectives/setup/setting.py   (contents, props 
changed)
Removed:
   cpsskins/branches/jmo-perspectives/configuration/perspectives/
   cpsskins/branches/jmo-perspectives/configuration/resources/
   cpsskins/branches/jmo-perspectives/configuration/styles/
Modified:
   cpsskins/branches/jmo-perspectives/browser/editing/views.py
   cpsskins/branches/jmo-perspectives/configuration/__init__.py
   cpsskins/branches/jmo-perspectives/configuration/configure.zcml
   cpsskins/branches/jmo-perspectives/configuration/meta.zcml
   cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml
   cpsskins/branches/jmo-perspectives/engines/default/formats/style.py
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
   cpsskins/branches/jmo-perspectives/perspectives/__init__.py
   cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/perspectives/perspective.py
   cpsskins/branches/jmo-perspectives/profiles/default/perspectives.zcml
   cpsskins/branches/jmo-perspectives/setup/configure.zcml
   cpsskins/branches/jmo-perspectives/setup/interfaces.py
   cpsskins/branches/jmo-perspectives/setup/resources.py
   cpsskins/branches/jmo-perspectives/setup/settings.py
   cpsskins/branches/jmo-perspectives/thememanager.py
Log:

- small refactoring that simplifies things a bit:

  - settings and resources are registered using the same directive

  - the resource manager is a utility

  - all settings implement the same ISetting interface

  - ...



Modified: cpsskins/branches/jmo-perspectives/browser/editing/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/editing/views.py (original)
+++ cpsskins/branches/jmo-perspectives/browser/editing/views.py Tue Dec  6 
22:41:19 2005
@@ -193,7 +193,7 @@
             raise TypeError("The element is not located in a storage.")
         resource = container.duplicate(removeSecurityProxy(context))
         resource = removeSecurityProxy(resource)
-        resources = IResourceManager(resource)
+        resources = getUtility(IResourceManager)
         resources.register(title=title, resource=resource, context=context)
         target = self.request.get('HTTP_REFERER', '.')
         self.request.response.redirect(target)

Modified: cpsskins/branches/jmo-perspectives/configuration/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/__init__.py        
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/__init__.py        Tue Dec 
 6 22:41:19 2005
@@ -30,11 +30,8 @@
 from cpsskins.configuration.filters.filter import IFilter, Filter
 from cpsskins.configuration.presentations.presentation import (
     IPresentation, Presentation)
-from cpsskins.configuration.perspectives.perspective import (
-    IPerspective, Perspective)
 from cpsskins.configuration.renderers.renderer import IRenderer, Renderer
 from cpsskins.configuration.widgets.widget import IWidget, Widget
-from cpsskins.configuration.styles.style import IStyle, Style
 
 # TODO: this will go away (replaced with utilities)
 

Modified: cpsskins/branches/jmo-perspectives/configuration/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/configure.zcml     
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/configure.zcml     Tue Dec 
 6 22:41:19 2005
@@ -2,8 +2,4 @@
 
   <include package=".engines" />
 
-  <include package=".perspectives" />
-
-  <include package=".styles" />
-
 </configure>

Modified: cpsskins/branches/jmo-perspectives/configuration/meta.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/meta.zcml  (original)
+++ cpsskins/branches/jmo-perspectives/configuration/meta.zcml  Tue Dec  6 
22:41:19 2005
@@ -12,10 +12,6 @@
 
   <include package=".presentations" file="meta.zcml" />
 
-  <include package=".perspectives" file="meta.zcml" />
-
-  <include package=".styles" file="meta.zcml" />
-
   <include package=".displays" file="meta.zcml" />
 
   <include package=".formats" file="meta.zcml" />
@@ -24,6 +20,6 @@
 
   <include package=".storages" file="meta.zcml" />
 
-  <include package=".resources" file="meta.zcml" />
+  <include package=".settings" file="meta.zcml" />
 
 </configure>

Added: cpsskins/branches/jmo-perspectives/configuration/settings/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/settings/__init__.py       
Tue Dec  6 22:41:19 2005
@@ -0,0 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2005 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+

Added: cpsskins/branches/jmo-perspectives/configuration/settings/configure.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/settings/configure.zcml    
Tue Dec  6 22:41:19 2005
@@ -0,0 +1,19 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:browser="http://namespaces.zope.org/browser";>
+
+  <localUtility class="cpsskins.configuration.styles.style.Style">
+
+      <require
+          permission="zope.ManageServices"
+          interface="cpsskins.configuration.styles.style.IStyle"
+      />
+
+  </localUtility>
+
+  <adapter
+      for="cpsskins.configuration.styles.style.IStyle"
+      factory="cpsskins.setup.settings.Resource"
+  />
+
+</configure>

Added: cpsskins/branches/jmo-perspectives/configuration/settings/meta.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/settings/meta.zcml Tue Dec 
 6 22:41:19 2005
@@ -0,0 +1,12 @@
+<configure xmlns="http://namespaces.zope.org/meta";>
+
+  <directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <directive
+       name="setting"
+       schema=".metadirectives.ISettingDirective"
+       handler=".metaconfigure.setting" />
+
+  </directives>
+
+</configure>

Added: 
cpsskins/branches/jmo-perspectives/configuration/settings/metaconfigure.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/settings/metaconfigure.py  
Tue Dec  6 22:41:19 2005
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# Copyright (c) 2005 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.component import queryUtility, getUtility
+from zope.configuration.exceptions import ConfigurationError
+from zope.xmlpickle import xmlpickle
+
+from cpsskins.engines.default.formats.style import Resources
+
+def setting(_context, name=u'', type=None, resource=None):
+
+    if queryUtility(type, name) is not None:
+        raise ConfigurationError(
+            "The '%s' setting has already been registered." % name)
+
+    if not resource:
+        raise ConfigurationError("Must specify a resource file.")
+
+    f = open(resource)
+    pickle = f.read()
+    f.close()
+
+    resource_object = xmlpickle.loads(pickle)
+
+    # register the style as a global setting
+    resources = Resources(resource_object)
+    resources.register(name=name, title=resource_object.title,
+                       resource=resource_object)
+

Added: 
cpsskins/branches/jmo-perspectives/configuration/settings/metadirectives.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/settings/metadirectives.py 
Tue Dec  6 22:41:19 2005
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# Copyright (c) 2005 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.configuration.fields import GlobalObject, Path
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import DottedName, TextLine
+
+_ = MessageFactory("cpsskins")
+
+class ISettingDirective(Interface):
+
+    name = DottedName(
+        title=_("Name"),
+        description=_("The name of the style."),
+        required=False,
+        min_dots=1,
+        )
+
+    type = GlobalObject(
+        title=_("Type"),
+        description=_("The type of setting."),
+        required=False,
+        )
+
+    resource = Path(
+        title=_("File"),
+        description=_("The resource file."),
+        required=False,
+        )
+

Modified: 
cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml   
Tue Dec  6 22:41:19 2005
@@ -30,26 +30,6 @@
       predicate=".style.hasStyle"
   />
 
-  <!-- Resource management -->
-
-  <utility
-      name="styles"
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      factory=".style.Resources"
-  />
-
-  <adapter
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      for=".interfaces.IStyle"
-      factory=".style.Resources"
-  />
-
-  <adapter
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      for="cpsskins.configuration.styles.style.IStyle"
-      factory=".style.Resources"
-  />
-
   <!-- XML export -->
 
   <browser:page

Modified: cpsskins/branches/jmo-perspectives/engines/default/formats/style.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/formats/style.py 
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/formats/style.py Tue Dec 
 6 22:41:19 2005
@@ -20,7 +20,7 @@
 from zope.app import pagetemplate
 from zope.app.container.btree import BTreeContainer
 from zope.app.publisher.browser import BrowserView
-from zope.interface import implements
+from zope.interface import implements, alsoProvides
 from zope.i18nmessageid import MessageFactory
 
 from cpsskins import configuration
@@ -29,9 +29,15 @@
 from cpsskins.relations import Predicate
 from cpsskins.setup.resources import ResourceManager
 from cpsskins.setup.interfaces import IResourceExporter
+from cpsskins.setup.interfaces import ISettingType, IResourceType
 
 _ = MessageFactory("cpsskins")
 
+alsoProvides(IStyle, ISettingType)
+alsoProvides(IStyle, IResourceType)
+
+IStyle.setTaggedValue('name', 'style')
+
 hasStyle = Predicate('_ has style _')
 
 class Style(Format, BTreeContainer):
@@ -152,8 +158,7 @@
 class Resources(ResourceManager):
     """This adapter makes styles usable as resources
     """
-    setting_type = configuration.IStyle
-    setting_factory = configuration.Style
+    resource_type = IStyle
 
 class Exporter(BrowserView):
     """This adapter makes it possible to export resources

Modified: cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  Tue Dec 
 6 22:41:19 2005
@@ -34,14 +34,11 @@
 <configure
     xmlns="http://namespaces.zope.org/cpsskins";>
 
-  <resources
-      type="%(resource_type)s"
-      file="%(resource_filename)s"
-  />
-
-  <perspective
+  <setting
       name="%(setting_name)s"
+      type="%(resource_type)s"
       resource="%(resource_name)s"
+      file="%(resource_filename)s"
   />
 
 </configure>
@@ -55,10 +52,12 @@
         info = {}
         # get all settings
         for name, setting in getUtilitiesFor(ISetting):
-            setting_type = queryType(setting, ISettingType)
-            info.setdefault(setting_type.getTaggedValue('name'), []).append({
+            resource = IResource(setting).getResource()
+            resource_type = queryType(resource, IResourceType)
+            info.setdefault(resource_type.getTaggedValue('name'), []).append({
                 'name': name,
                 'setting': setting,
+                'resource': resource,
                 'customized': False,
                 })
         return info
@@ -68,7 +67,7 @@
             raise KeyError("Must specify a setting's name.")
 
         setting =  getUtility(ISetting, name)
-        resources = IResourceManager(setting)
+        resources = getUtility(IResourceManager)
         resources.customize(name=name, context=self.context)
 
         target = self.request.get('HTTP_REFERER', '.')

Modified: cpsskins/branches/jmo-perspectives/perspectives/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/__init__.py (original)
+++ cpsskins/branches/jmo-perspectives/perspectives/__init__.py Tue Dec  6 
22:41:19 2005
@@ -17,5 +17,5 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.perspectives.perspective import Perspective, Relatable, Resources
+from cpsskins.perspectives.perspective import Perspective, Relatable
 

Modified: cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      Tue Dec 
 6 22:41:19 2005
@@ -26,24 +26,4 @@
 
   </content>
 
-  <!-- Resource management -->
-
-  <utility
-      name="perspectives"
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      factory=".Resources"
-  />
-
-  <adapter
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      for="cpsskins.configuration.perspectives.perspective.IPerspective"
-      factory=".Resources"
-  />
-
-  <adapter
-      provides="cpsskins.setup.interfaces.IResourceManager"
-      for=".interfaces.IPerspective"
-      factory=".Resources"
-  />
-
 </configure>

Modified: cpsskins/branches/jmo-perspectives/perspectives/perspective.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/perspective.py      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/perspective.py      Tue Dec 
 6 22:41:19 2005
@@ -17,11 +17,17 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.interface import implements
+from zope.interface import implements, alsoProvides
 
 from cpsskins import configuration
 from cpsskins.setup.resources import ResourceManager
 from cpsskins.perspectives.interfaces import IPerspective
+from cpsskins.setup.interfaces import ISettingType, IResourceType
+
+alsoProvides(IPerspective, ISettingType)
+alsoProvides(IPerspective, IResourceType)
+
+IPerspective.setTaggedValue('name', 'perspective')
 
 class Perspective(object):
     """A perspective
@@ -55,9 +61,3 @@
     def __str__(self):
         return str(self.context)
 
-class Resources(ResourceManager):
-    """This adapter makes perspectives usable as resources
-    """
-    setting_type = configuration.IPerspective
-    setting_factory = configuration.Perspective
-

Modified: cpsskins/branches/jmo-perspectives/profiles/default/perspectives.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/profiles/default/perspectives.zcml       
(original)
+++ cpsskins/branches/jmo-perspectives/profiles/default/perspectives.zcml       
Tue Dec  6 22:41:19 2005
@@ -1,19 +1,10 @@
 <configure
     xmlns="http://namespaces.zope.org/cpsskins";>
 
-  <!-- Resources -->
-
-  <resources
+  <setting
+      name="perspective.global"
       type="cpsskins.perspectives.interfaces.IPerspective"
-      file="perspectives.xml"
-  />
-
-
-  <!-- Settings -->
-
-  <perspective
-      name="setting.perspective.global"
-      resource="resource.perspective.global"
+      resource="perspectives.xml"
   />
 
 </configure>

Modified: cpsskins/branches/jmo-perspectives/setup/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/configure.zcml     (original)
+++ cpsskins/branches/jmo-perspectives/setup/configure.zcml     Tue Dec  6 
22:41:19 2005
@@ -12,4 +12,15 @@
       provides="cpsskins.relations.interfaces.IRelatable"
   />
 
+  <adapter
+      for=".interfaces.ISetting"
+      factory=".settings.Resource"
+      provides="cpsskins.setup.interfaces.IResource"
+  />
+
+  <utility
+      provides="cpsskins.setup.interfaces.IResourceManager"
+      factory="cpsskins.setup.resources.ResourceManager"
+  />
+
 </configure>

Modified: cpsskins/branches/jmo-perspectives/setup/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/interfaces.py      (original)
+++ cpsskins/branches/jmo-perspectives/setup/interfaces.py      Tue Dec  6 
22:41:19 2005
@@ -68,8 +68,8 @@
     def lookup(name, context, default):
         """Look up a resource."""
 
-    def list(context):
-        """List all resources."""
+    def list(type, context):
+        """List all resources of a given type."""
 
     def customize(name, context):
         """Customize a resource."""

Modified: cpsskins/branches/jmo-perspectives/setup/resources.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/resources.py       (original)
+++ cpsskins/branches/jmo-perspectives/setup/resources.py       Tue Dec  6 
22:41:19 2005
@@ -24,16 +24,15 @@
 from zope.app.container.interfaces import INameChooser
 from zope.interface import implements
 from zope.component import (getUtilitiesFor, queryUtility, getUtility,
-                            provideUtility)
+                            provideUtility, providedBy)
 
 from cpsskins.setup.interfaces import IResourceManager, IResource, ISettings
+from cpsskins.setup.interfaces import ISetting
+from cpsskins.setup.setting import Setting
 
 class ResourceManager(object):
     """Resource manager utility"""
 
-    setting_type = None
-    setting_factory = None
-
     implements(IResourceManager)
 
     def __init__(self, context=None):
@@ -42,22 +41,21 @@
     def register(self, name=u'', title=u'', resource=None, context=None):
         """Register the setting as a utility.
         """
-        factory = self.setting_factory
 
         # register as a global utility
         if context is None:
-            setting = factory(title=title, resource=resource, readonly=True)
-            provideUtility(setting, self.setting_type, name)
+            setting = Setting(title=title, resource=resource, readonly=True)
+            provideUtility(setting, ISetting, name)
 
         # register as a local utility
         else:
             settings = getUtility(ISettings, context=context)
             chooser = INameChooser(settings)
             name = name or chooser.chooseName(title, object)
-            setting = factory(title=title, resource=resource)
+            setting = Setting(title=title, resource=resource)
             settings[name] = setting
 
-            reg = UtilityRegistration(name, self.setting_type, settings[name])
+            reg = UtilityRegistration(name, ISetting, settings[name])
             settings.registrationManager.addRegistration(reg)
             reg.status = ActiveStatus
 
@@ -65,7 +63,7 @@
         if not name:
             raise KeyError("Must specify a resource name.")
 
-        setting = queryUtility(self.setting_type, name, context=context)
+        setting = queryUtility(ISetting, name, context=context)
         if setting is None:
             return default
 
@@ -74,19 +72,23 @@
             return resource_getter.getResource()
         return default
 
-    def list(self, context=None):
+    def list(self, type=None, context=None):
         resources = []
-        for name, setting in getUtilitiesFor(self.setting_type):
+        for name, setting in getUtilitiesFor(ISetting):
             resource_getter = IResource(setting, None)
-            if resource_getter is not None:
-                resources.append(resource_getter.getResource())
+            if resource_getter is None:
+                continue
+            resource = resource_getter.getResource()
+            if not type in list(providedBy(resource)):
+                continue
+            resources.append(resource)
         return resources
 
     def customize(self, name=u'', context=None):
         if context is None:
             raise ValueError("Must specify a context.")
 
-        setting = queryUtility(self.setting_type, name)
+        setting = queryUtility(ISetting, name)
         if setting is None:
             raise ValueError("No such setting.")
 

Added: cpsskins/branches/jmo-perspectives/setup/setting.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/setting.py Tue Dec  6 22:41:19 2005
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2005 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.app.component.site import SiteManagementFolder
+from zope.component import adapts
+from zope.interface import implements
+from zope.app.container.contained import Contained
+from zope.interface import implements
+from persistent import Persistent
+
+from cpsskins.setup.interfaces import ISetting
+
+class Setting(Persistent, Contained):
+    """A setting configuration item.
+    """
+    implements(ISetting)
+
+    def __init__(self, title=u'', type=None, readonly=False, resource=None):
+        self.title = title
+        self.type = type
+        self.readonly = readonly
+        self.resource = resource
+

Modified: cpsskins/branches/jmo-perspectives/setup/settings.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/settings.py        (original)
+++ cpsskins/branches/jmo-perspectives/setup/settings.py        Tue Dec  6 
22:41:19 2005
@@ -48,4 +48,3 @@
     def __str__(self):
         return str(self.context.title)
 
-

Modified: cpsskins/branches/jmo-perspectives/thememanager.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/thememanager.py  (original)
+++ cpsskins/branches/jmo-perspectives/thememanager.py  Tue Dec  6 22:41:19 2005
@@ -37,6 +37,7 @@
 from cpsskins.interfaces import IThemeManagement, IImageCache
 from cpsskins.ontology import isDefault, hasFormat, hasDisplay
 from cpsskins.perspectives import Perspective
+from cpsskins.perspectives.interfaces import IPerspective
 from cpsskins.portlets.interfaces import IPortletStorage
 from cpsskins.portlets.storage import PortletStorage
 from cpsskins.relations import MonadicRelation
@@ -210,16 +211,17 @@
     ###################################################################
 
     def listPerspectives(self):
-        return getUtility(IResourceManager, 'perspectives').list(self)
+        return getUtility(IResourceManager).list(type=IPerspective,
+                                                 context=self)
 
     def getPerspectiveByName(self, name):
         """Return a perspective by name."""
-        return getUtility(IResourceManager, 'perspectives').lookup(name, self)
+        return getUtility(IResourceManager).lookup(name=name, context=self)
 
     def addPerspective(self, name, title):
         """Add a perspective to the perspective storage.
         """
         perspective = Perspective(name=name, title=title)
-        mgr = getUtility(IResourceManager, 'perspectives')
+        mgr = getUtility(IResourceManager)
         mgr.register(title=title, resource=perspective, context=self)
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to