Author: jmorliaguet
Date: Mon Nov 21 18:48:44 2005
New Revision: 1909

Added:
   cpsskins/branches/jmo-perspectives/setup/
   cpsskins/branches/jmo-perspectives/setup/README.txt   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/setup/__init__.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/setup/interfaces.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/setup/resources.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/setup/settings.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/utils.py   (contents, props changed)
Removed:
   cpsskins/branches/jmo-perspectives/resources/
   cpsskins/branches/jmo-perspectives/settings.py
Modified:
   cpsskins/branches/jmo-perspectives/__init__.py
   cpsskins/branches/jmo-perspectives/browser/caching.py
   cpsskins/branches/jmo-perspectives/browser/editing/settings.py
   cpsskins/branches/jmo-perspectives/browser/manager/__init__.py
   cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py
   cpsskins/branches/jmo-perspectives/browser/rendering/engine.py
   cpsskins/branches/jmo-perspectives/browser/skin/__init__.py
   cpsskins/branches/jmo-perspectives/browser/tree/slot.py
   cpsskins/branches/jmo-perspectives/configuration/perspectives/configure.zcml
   
cpsskins/branches/jmo-perspectives/configuration/perspectives/metaconfigure.py
   cpsskins/branches/jmo-perspectives/configuration/perspectives/perspective.py
   cpsskins/branches/jmo-perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/controllers/__init__.py
   cpsskins/branches/jmo-perspectives/controllers/cell.py
   cpsskins/branches/jmo-perspectives/controllers/pageblock.py
   cpsskins/branches/jmo-perspectives/controllers/portlet.py
   cpsskins/branches/jmo-perspectives/controllers/slot.py
   cpsskins/branches/jmo-perspectives/controllers/theme.py
   cpsskins/branches/jmo-perspectives/controllers/themepage.py
   cpsskins/branches/jmo-perspectives/elements/display.py
   cpsskins/branches/jmo-perspectives/elements/format.py
   cpsskins/branches/jmo-perspectives/elements/presentation.py
   cpsskins/branches/jmo-perspectives/elements/slot.py
   cpsskins/branches/jmo-perspectives/elements/theme.py
   cpsskins/branches/jmo-perspectives/elements/themepage.py
   cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py
   cpsskins/branches/jmo-perspectives/engines/authoring/jsonrpc.py
   cpsskins/branches/jmo-perspectives/engines/default/filters/effect/__init__.py
   cpsskins/branches/jmo-perspectives/engines/default/filters/style/css.py
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
   cpsskins/branches/jmo-perspectives/interfaces.py
   cpsskins/branches/jmo-perspectives/perspectives/__init__.py
   cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/relations/tool.py
   cpsskins/branches/jmo-perspectives/thememanager.py
Log:

- moved the settings and resources modules to 'setup'

- moved utility methods to cpsskins.utils

- cleaned up imports



Modified: cpsskins/branches/jmo-perspectives/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/__init__.py      (original)
+++ cpsskins/branches/jmo-perspectives/__init__.py      Mon Nov 21 18:48:44 2005
@@ -18,4 +18,3 @@
 __docformat__ = "reStructuredText"
 
 from cpsskins.elements.portlet import Portlet
-from cpsskins.thememanager import getThemeManager, getContexts

Modified: cpsskins/branches/jmo-perspectives/browser/caching.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/caching.py       (original)
+++ cpsskins/branches/jmo-perspectives/browser/caching.py       Mon Nov 21 
18:48:44 2005
@@ -20,7 +20,7 @@
 from zope.app.file.browser.image import ImageData
 from zope.app.publisher.browser import BrowserView
 
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class ImageCacheView(BrowserView):
     """A view for accessing cached images.

Modified: cpsskins/branches/jmo-perspectives/browser/editing/settings.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/editing/settings.py      
(original)
+++ cpsskins/branches/jmo-perspectives/browser/editing/settings.py      Mon Nov 
21 18:48:44 2005
@@ -22,7 +22,7 @@
 from zope.interface import implements, Interface
 from zope.security.proxy import removeSecurityProxy
 
-from cpsskins.resources.manager import IResourceManager
+from cpsskins.setup.interfaces import IResourceManager
 
 class ISettingsView(Interface):
 

Modified: cpsskins/branches/jmo-perspectives/browser/manager/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/manager/__init__.py      
(original)
+++ cpsskins/branches/jmo-perspectives/browser/manager/__init__.py      Mon Nov 
21 18:48:44 2005
@@ -33,7 +33,7 @@
 from cpsskins.elements.pageblock import PageBlock
 from cpsskins.elements.cell import Cell
 from cpsskins.elements.slot import Slot
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IThemeManagerView
 
 class ThemeManagerView(BrowserView):

Modified: cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py  
(original)
+++ cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py  Mon Nov 
21 18:48:44 2005
@@ -22,7 +22,7 @@
 from zope.app.session.interfaces import ISession
 
 from cpsskins.browser.rendering.interfaces import IViewer
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class NegociationView(BrowserView):
     """A view for the negociation of the effective theme, perspective, ...

Modified: cpsskins/branches/jmo-perspectives/browser/rendering/engine.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/rendering/engine.py      
(original)
+++ cpsskins/branches/jmo-perspectives/browser/rendering/engine.py      Mon Nov 
21 18:48:44 2005
@@ -25,7 +25,7 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 
-from cpsskins import getThemeManager, getContexts
+from cpsskins.utils import getThemeManager, getContexts
 from cpsskins.browser.negociation.interfaces import INegociation
 from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.elements.interfaces import IType

Modified: cpsskins/branches/jmo-perspectives/browser/skin/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/skin/__init__.py (original)
+++ cpsskins/branches/jmo-perspectives/browser/skin/__init__.py Mon Nov 21 
18:48:44 2005
@@ -21,7 +21,7 @@
 from zope.publisher.interfaces.browser import ILayer, IDefaultBrowserLayer
 from zope.publisher.interfaces.browser import IBrowserRequest
 
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class IDefaultLayer(ILayer, IBrowserRequest):
     """The default layer"""

Modified: cpsskins/branches/jmo-perspectives/browser/tree/slot.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/tree/slot.py     (original)
+++ cpsskins/branches/jmo-perspectives/browser/tree/slot.py     Mon Nov 21 
18:48:44 2005
@@ -29,7 +29,7 @@
 from cpsskins.ontology import hasPortlet, hasPortletFromPerspective
 from cpsskins.relations import DyadicRelation, TriadicRelation
 from cpsskins.relations.tool import RelationTool
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from cpsskins.storage.interfaces import IPortletStorage, IRelationStorage
 from interfaces import INodeAdding, INodeRemoving, INodeOrdering, INodeMoving
 from interfaces import INodeDuplicating

Modified: 
cpsskins/branches/jmo-perspectives/configuration/perspectives/configure.zcml
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/configuration/perspectives/configure.zcml    
    (original)
+++ 
cpsskins/branches/jmo-perspectives/configuration/perspectives/configure.zcml    
    Mon Nov 21 18:48:44 2005
@@ -13,7 +13,7 @@
 
   <adapter
       for=".perspective.IPerspective"
-      factory="cpsskins.settings.Resource"
+      factory="cpsskins.setup.settings.Resource"
   />
 
 </configure>

Modified: 
cpsskins/branches/jmo-perspectives/configuration/perspectives/metaconfigure.py
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/configuration/perspectives/metaconfigure.py  
    (original)
+++ 
cpsskins/branches/jmo-perspectives/configuration/perspectives/metaconfigure.py  
    Mon Nov 21 18:48:44 2005
@@ -22,10 +22,9 @@
 from zope.interface import alsoProvides
 
 from cpsskins import configuration
-from cpsskins.interfaces import ISettingType
 from cpsskins.perspectives import Perspective, Resources
 from cpsskins.perspectives.interfaces import IPerspective
-from cpsskins.resources.manager import IResourceManager
+from cpsskins.setup.interfaces import IResourceManager, ISettingType
 
 alsoProvides(configuration.IPerspective, ISettingType)
 

Modified: 
cpsskins/branches/jmo-perspectives/configuration/perspectives/perspective.py
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/configuration/perspectives/perspective.py    
    (original)
+++ 
cpsskins/branches/jmo-perspectives/configuration/perspectives/perspective.py    
    Mon Nov 21 18:48:44 2005
@@ -18,11 +18,11 @@
 
 __docformat__ = "reStructuredText"
 
+from zope.app.container.contained import Contained
 from zope.interface import implements, Interface, Attribute
 from persistent import Persistent
-from zope.app.container.contained import Contained
 
-from cpsskins.interfaces import ISetting
+from cpsskins.setup.interfaces import ISetting
 
 class IPerspective(ISetting):
     """A perspective configuration item."""

Modified: cpsskins/branches/jmo-perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/configure.zcml   (original)
+++ cpsskins/branches/jmo-perspectives/configure.zcml   Mon Nov 21 18:48:44 2005
@@ -55,12 +55,12 @@
 
   </content>
 
-  <localUtility class=".settings.Settings">
+  <localUtility class=".setup.settings.Settings">
 
     <require
         permission="zope.ManageSite"
-        interface=".interfaces.ISettings"
-        set_schema=".interfaces.ISettings"
+        interface=".setup.interfaces.ISettings"
+        set_schema=".setup.interfaces.ISettings"
         />
 
     <require

Modified: cpsskins/branches/jmo-perspectives/controllers/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/__init__.py  (original)
+++ cpsskins/branches/jmo-perspectives/controllers/__init__.py  Mon Nov 21 
18:48:44 2005
@@ -20,7 +20,7 @@
 from zope.app.copypastemove import dispatchToSublocations
 from zope.interface import implements
 
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 class Controller(object):

Modified: cpsskins/branches/jmo-perspectives/controllers/cell.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/cell.py      (original)
+++ cpsskins/branches/jmo-perspectives/controllers/cell.py      Mon Nov 21 
18:48:44 2005
@@ -21,7 +21,7 @@
 
 from cpsskins.controllers import Controller
 from cpsskins.elements.interfaces import IPresentable
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 class CellController(Controller):

Modified: cpsskins/branches/jmo-perspectives/controllers/pageblock.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/pageblock.py (original)
+++ cpsskins/branches/jmo-perspectives/controllers/pageblock.py Mon Nov 21 
18:48:44 2005
@@ -20,7 +20,7 @@
 from zope.interface import implements
 
 from cpsskins.controllers import Controller
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from cpsskins.elements.interfaces import IPresentable
 from interfaces import IController
 

Modified: cpsskins/branches/jmo-perspectives/controllers/portlet.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/portlet.py   (original)
+++ cpsskins/branches/jmo-perspectives/controllers/portlet.py   Mon Nov 21 
18:48:44 2005
@@ -23,7 +23,7 @@
 from cpsskins.controllers import Controller
 from cpsskins.elements.interfaces import ICell
 from cpsskins.elements.interfaces import IPresentable
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 class PortletController(Controller):

Modified: cpsskins/branches/jmo-perspectives/controllers/slot.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/slot.py      (original)
+++ cpsskins/branches/jmo-perspectives/controllers/slot.py      Mon Nov 21 
18:48:44 2005
@@ -21,7 +21,7 @@
 
 from cpsskins.controllers import Controller
 from cpsskins.elements.interfaces import IDisplayable, IPresentable
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 class SlotController(Controller):

Modified: cpsskins/branches/jmo-perspectives/controllers/theme.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/theme.py     (original)
+++ cpsskins/branches/jmo-perspectives/controllers/theme.py     Mon Nov 21 
18:48:44 2005
@@ -22,7 +22,7 @@
 
 from cpsskins.controllers import Controller
 from cpsskins.configuration.interfaces import IRegistry
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 storage_registry = getUtility(IRegistry, 'storages')

Modified: cpsskins/branches/jmo-perspectives/controllers/themepage.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/controllers/themepage.py (original)
+++ cpsskins/branches/jmo-perspectives/controllers/themepage.py Mon Nov 21 
18:48:44 2005
@@ -21,7 +21,7 @@
 
 from cpsskins.controllers import Controller
 from cpsskins.elements.interfaces import IPresentable
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IController
 
 class ThemePageController(Controller):

Modified: cpsskins/branches/jmo-perspectives/elements/display.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/display.py      (original)
+++ cpsskins/branches/jmo-perspectives/elements/display.py      Mon Nov 21 
18:48:44 2005
@@ -31,8 +31,8 @@
 from cpsskins.relations import DyadicRelation, TriadicRelation
 from cpsskins.relations.tool import RelationTool
 from cpsskins.ontology import hasDisplay, hasDisplayFromPerspective
-from cpsskins.thememanager import getThemeManager
 from cpsskins.storage.interfaces import IDisplayStorage
+from cpsskins.utils import getThemeManager
 from interfaces import IDisplayable, IDisplay, IDisplayType
 
 class Display(Element):

Modified: cpsskins/branches/jmo-perspectives/elements/format.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/format.py       (original)
+++ cpsskins/branches/jmo-perspectives/elements/format.py       Mon Nov 21 
18:48:44 2005
@@ -29,7 +29,7 @@
 from cpsskins.ontology import hasFormat
 from cpsskins.relations import DyadicRelation
 from cpsskins.relations.tool import RelationTool
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from cpsskins.storage.interfaces import IFormatStorage
 
 class Format(Element):

Modified: cpsskins/branches/jmo-perspectives/elements/presentation.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/presentation.py (original)
+++ cpsskins/branches/jmo-perspectives/elements/presentation.py Mon Nov 21 
18:48:44 2005
@@ -25,7 +25,7 @@
 from cpsskins.elements.interfaces import IType, IDisplayable, IFormattable
 from cpsskins.ontology import hasFormat, hasDisplay, hasDisplayFromPerspective
 from cpsskins.relations.tool import RelationTool
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import IPresentable
 
 class Presentable(object):

Modified: cpsskins/branches/jmo-perspectives/elements/slot.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/slot.py (original)
+++ cpsskins/branches/jmo-perspectives/elements/slot.py Mon Nov 21 18:48:44 2005
@@ -26,7 +26,7 @@
 from cpsskins.relations.tool import RelationTool
 from cpsskins.relations.interfaces import IRelatable
 from cpsskins.storage.interfaces import IPortletStorage
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class Slot(InnerNode):
     """Slot

Modified: cpsskins/branches/jmo-perspectives/elements/theme.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/theme.py        (original)
+++ cpsskins/branches/jmo-perspectives/elements/theme.py        Mon Nov 21 
18:48:44 2005
@@ -23,9 +23,9 @@
 
 from cpsskins.elements.interfaces import INode, INodeTraverser
 from cpsskins.perspectives import Perspective
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 from interfaces import ITheme, IThemePage
-from cpsskins.resources.interfaces import IResourceManager
+from cpsskins.setup.interfaces import IResourceManager
 
 class Theme(SiteManagementFolder):
     """Theme

Modified: cpsskins/branches/jmo-perspectives/elements/themepage.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/themepage.py    (original)
+++ cpsskins/branches/jmo-perspectives/elements/themepage.py    Mon Nov 21 
18:48:44 2005
@@ -21,7 +21,7 @@
 
 from cpsskins.elements import InnerNode
 from cpsskins.elements.interfaces import IThemePage
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class ThemePage(InnerNode):
     """Theme Page.

Modified: cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py   
(original)
+++ cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py   Mon Nov 
21 18:48:44 2005
@@ -24,11 +24,11 @@
 from zope.interface import implements, Interface
 from zope.security.proxy import removeSecurityProxy
 
+from cpsskins.utils import getThemeManager
 from cpsskins.elements.interfaces import IElement, IPresentable
 from cpsskins.elements.interfaces import IDisplayable, IFormattable
 from cpsskins.browser.rendering.interfaces import IViewer
-from cpsskins.thememanager import getThemeManager
-from cpsskins.resources.interfaces import IResourceManager
+from cpsskins.setup.interfaces import IResourceManager
 
 class IAuthoring(Interface):
 

Modified: cpsskins/branches/jmo-perspectives/engines/authoring/jsonrpc.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/authoring/jsonrpc.py     
(original)
+++ cpsskins/branches/jmo-perspectives/engines/authoring/jsonrpc.py     Mon Nov 
21 18:48:44 2005
@@ -32,7 +32,7 @@
 from cpsskins.browser.tree.interfaces import INodeMoving, INodeOrdering
 from cpsskins.browser.tree.interfaces import INodeDuplicating
 from cpsskins.browser.rendering.interfaces import IViewer
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class Methods(object):
     """JSON-RPC methods.

Modified: 
cpsskins/branches/jmo-perspectives/engines/default/filters/effect/__init__.py
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/engines/default/filters/effect/__init__.py   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/engines/default/filters/effect/__init__.py   
    Mon Nov 21 18:48:44 2005
@@ -29,7 +29,7 @@
 from cpsskins.model.interfaces import IImage
 from cpsskins.elements.interfaces import IDisplay
 from cpsskins.browser.rendering.interfaces import IFilterView
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 INFO = logging.INFO
 logger = logging.getLogger()

Modified: 
cpsskins/branches/jmo-perspectives/engines/default/filters/style/css.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/filters/style/css.py     
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/filters/style/css.py     
Mon Nov 21 18:48:44 2005
@@ -23,7 +23,7 @@
 from cpsskins.engines.default.formats.style import IStyle
 from cpsskins.engines.default.filters.style import ICSSRenderer
 from cpsskins.storage.interfaces import IFormatStorage
-from cpsskins.thememanager import getThemeManager
+from cpsskins.utils import getThemeManager
 
 class IStylesheetView(Interface):
 

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  Mon Nov 
21 18:48:44 2005
@@ -22,8 +22,8 @@
 from zope.app.interface import queryType
 from zope import xmlpickle 
 
-from cpsskins.interfaces import ISettings, ISetting, ISettingType, IResource
-from cpsskins.resources.manager import IResourceManager
+from cpsskins.setup.interfaces import (ISettings, ISetting, ISettingType,
+                                       IResource, IResourceManager)
 
 class SiteDesignerView(BrowserView):
 

Modified: cpsskins/branches/jmo-perspectives/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/interfaces.py    (original)
+++ cpsskins/branches/jmo-perspectives/interfaces.py    Mon Nov 21 18:48:44 2005
@@ -90,30 +90,3 @@
     def __setitem__(key, value):
         """ """
 
-# Settings
-
-class ISettings(Interface):
-    """ """
-
-class ISettingType(IInterface):
-    """ """
-
-class ISetting(Interface):
-    """ """
-
-    title = TextLine(
-        title=u"Title",
-        description=u"The setting's title",
-        )
-
-    readonly = Bool(
-        title=u"Read-only",
-        description=u"The setting is read-only",
-        )
-
-    resource = Attribute("The resource.")
-
-class IResource(Interface):
-
-    def getResource():
-        """Return the resource."""

Modified: cpsskins/branches/jmo-perspectives/perspectives/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/__init__.py (original)
+++ cpsskins/branches/jmo-perspectives/perspectives/__init__.py Mon Nov 21 
18:48:44 2005
@@ -20,7 +20,7 @@
 from zope.interface import implements
 
 from cpsskins import configuration
-from cpsskins.resources.manager import ResourceManager
+from cpsskins.setup.resources import ResourceManager
 from interfaces import IPerspective
 
 class Perspective(object):

Modified: cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      Mon Nov 
21 18:48:44 2005
@@ -30,18 +30,18 @@
 
   <utility
       name="perspectives"
-      provides="cpsskins.resources.manager.IResourceManager"
+      provides="cpsskins.setup.interfaces.IResourceManager"
       factory=".Resources"
   />
 
   <adapter
-      provides="cpsskins.resources.manager.IResourceManager"
+      provides="cpsskins.setup.interfaces.IResourceManager"
       for="cpsskins.configuration.perspectives.perspective.IPerspective"
       factory=".Resources"
   />
 
   <adapter
-      provides="cpsskins.resources.manager.IResourceManager"
+      provides="cpsskins.setup.interfaces.IResourceManager"
       for=".interfaces.IPerspective"
       factory=".Resources"
   />

Modified: cpsskins/branches/jmo-perspectives/relations/tool.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/relations/tool.py        (original)
+++ cpsskins/branches/jmo-perspectives/relations/tool.py        Mon Nov 21 
18:48:44 2005
@@ -21,6 +21,7 @@
 
 from cpsskins.storage.interfaces import IRelationStorage
 from interfaces import IRelationTool
+from cpsskins.utils import getThemeManager
 
 class RelationTool(object):
 
@@ -30,7 +31,6 @@
         self.context = context
 
         # Set the storage
-        from cpsskins.thememanager import getThemeManager
         tmutil = getThemeManager()
         theme = tmutil.getThemeInContext(context)
         self.storage = theme.getStorage(IRelationStorage)

Added: cpsskins/branches/jmo-perspectives/setup/README.txt
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/README.txt Mon Nov 21 18:48:44 2005
@@ -0,0 +1,9 @@
+
+=========
+RESOURCES
+=========
+
+Resources are objects that have been given an official role in the
+application.
+
+They are usually registered as part of application settings.

Added: cpsskins/branches/jmo-perspectives/setup/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/__init__.py        Mon Nov 21 
18:48:44 2005
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# 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/setup/interfaces.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/interfaces.py      Mon Nov 21 
18:48:44 2005
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# 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.interface import implements, Interface, Attribute
+from zope.interface.interfaces import IInterface
+from zope.schema import Bool, TextLine
+
+class ISettings(Interface):
+    """ """
+
+class ISettingType(IInterface):
+    """ """
+
+class ISetting(Interface):
+    """ """
+
+    title = TextLine(
+        title=u"Title",
+        description=u"The setting's title",
+        )
+
+    readonly = Bool(
+        title=u"Read-only",
+        description=u"The setting is read-only",
+        )
+
+    resource = Attribute("The resource.")
+
+class IResource(Interface):
+
+    def getResource():
+        """Return the resource."""
+
+class IResourceManager(Interface):
+    """A resource manager is used to manage the resource used by the
+    application. Resources can be stored:
+
+    - in a global utility
+
+    - in a local utility
+
+    - in a local storage
+
+    """
+
+    def register(title, resource, context):
+        """Register a resource."""
+
+    def lookup(name, context, default):
+        """Look up a resource."""
+
+    def list(context):
+        """List all resources."""
+
+    def customize(name, context):
+        """Customize a resource."""

Added: cpsskins/branches/jmo-perspectives/setup/resources.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/resources.py       Mon Nov 21 
18:48:44 2005
@@ -0,0 +1,99 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Resource manager
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.site import UtilityRegistration
+from zope.app.container.interfaces import INameChooser
+from zope.app.location.pickling import locationCopy
+from zope.interface import implements, Interface
+from zope.component import (getUtilitiesFor, queryUtility, getUtility,
+                            provideUtility)
+
+from cpsskins.setup.interfaces import IResourceManager, IResource, ISettings
+
+class ResourceManager(object):
+    """Resource manager utility"""
+
+    setting_type = None
+    setting_factory = None
+
+    implements(IResourceManager)
+
+    def __init__(self, context=None):
+        self.context = context
+
+    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)
+           print repr(setting)
+            provideUtility(setting, self.setting_type, name)
+
+        # register as a local utility
+        else:
+            settings = getUtility(ISettings, context=context)
+            chooser = INameChooser(settings)
+            name = name or chooser.chooseName(title, object)
+            settings[name] = factory(title=title, resource=resource)
+
+            reg = UtilityRegistration(name, self.setting_type, settings[name])
+            settings.registrationManager.addRegistration(reg)
+            reg.status = ActiveStatus
+
+    def lookup(self, name=u'', context=None, default=None):
+        if not name:
+            raise KeyError("Must specify a resource name.")
+
+        setting = queryUtility(self.setting_type, name, context=context)
+        if setting is None:
+            return default
+
+        resource_getter = IResource(setting, None)
+        if resource_getter is not None:
+            return resource_getter.getResource()
+        return default
+
+    def list(self, context=None):
+        resources = []
+        for name, setting in getUtilitiesFor(self.setting_type):
+            resource_getter = IResource(setting, None)
+            if resource_getter is not None:
+                resources.append(resource_getter.getResource())
+        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)
+        if setting is None:
+            raise ValueError("No such setting.")
+
+        resource = None
+        resource_getter = IResource(setting)
+        if resource_getter is not None:
+            resource = locationCopy(resource_getter.getResource())
+
+        self.register(name=name, title=setting.title, resource=resource,
+                      context=context)
+

Added: cpsskins/branches/jmo-perspectives/setup/settings.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/setup/settings.py        Mon Nov 21 
18:48:44 2005
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# 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 cpsskins.setup.interfaces import IResource, ISettings
+
+class Settings(SiteManagementFolder):
+
+    implements(ISettings)
+
+class Resource(object):
+    """This adapts settings to resources
+    """
+    adapts(ISettings)
+    implements(IResource)
+
+    def __init__(self, context):
+        self.context = context
+
+    def getResource(self):
+        return self.context.resource
+

Modified: cpsskins/branches/jmo-perspectives/thememanager.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/thememanager.py  (original)
+++ cpsskins/branches/jmo-perspectives/thememanager.py  Mon Nov 21 18:48:44 2005
@@ -27,8 +27,9 @@
 from zope.interface import implements
 
 from caching import ImageCache
-from settings import Settings
-from interfaces import IThemeManagement, IImageCache, ISettings
+from cpsskins.setup.interfaces import ISettings
+from cpsskins.setup.settings import Settings
+from interfaces import IThemeManagement, IImageCache
 from elements.interfaces import ITheme, IThemeContainer, IThemePage
 from elements.interfaces import IFormattable
 from ontology import isDefault, hasFormat, hasDisplay
@@ -36,8 +37,6 @@
 from relations.tool import RelationTool
 from storage.interfaces import IRelationStorage
 
-THEMES_MANAGER_NAME = 'themes'
-
 def added(object, event):
     object.registerUtilities()
 
@@ -194,12 +193,3 @@
         relations = reltool.search(first=object, predicate=hasFormat)
         reltool.remove(relations)
 
-
-def getThemeManager():
-    return queryUtility(IThemeManagement, THEMES_MANAGER_NAME)
-
-def getContexts(request):
-    if 'cpsskins.contexts' not in request.annotations:
-         request.annotations['cpsskins.contexts'] = {}
-    return request.annotations['cpsskins.contexts']
-

Added: cpsskins/branches/jmo-perspectives/utils.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/utils.py Mon Nov 21 18:48:44 2005
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# 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"
+
+THEMES_MANAGER_NAME = 'themes'
+
+def getThemeManager():
+    return queryUtility(IThemeManagement, THEMES_MANAGER_NAME)
+
+def getContexts(request):
+    if 'cpsskins.contexts' not in request.annotations:
+         request.annotations['cpsskins.contexts'] = {}
+    return request.annotations['cpsskins.contexts']
+
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to