Author: jmorliaguet
Date: Sat Nov  5 22:48:10 2005
New Revision: 29017

Added:
   z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/display.py   
(contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/engine.py   
(contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/filter.py   
(contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/format.py   
(contents, props changed)
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/presentation.py
   (contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/renderer.py 
  (contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py   
(contents, props changed)
Removed:
   z3lab/cpsskins/branches/jmo-perspectives/elements/engine.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/filter.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/renderer.py
Modified:
   z3lab/cpsskins/branches/jmo-perspectives/browser/rendering/engine.py
   z3lab/cpsskins/branches/jmo-perspectives/configuration/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/metaconfigure.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/configuration/portlets/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/metaconfigure.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/display.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/format.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/interfaces.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/filters/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/layout/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/layout.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/widget.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/interfaces.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/layoutdesigner/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/filters/__init__.py
Log:

- fixed logical inconsistency:

  the components used to register objects with provideUtility cannot use
  the same class as the registered objects themselves

  so we use: cpsskins.configuration.Display to register a
  cpsskins.element.Display element



Modified: z3lab/cpsskins/branches/jmo-perspectives/browser/rendering/engine.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/browser/rendering/engine.py        
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/browser/rendering/engine.py        
Sat Nov  5 22:48:10 2005
@@ -28,13 +28,15 @@
 
 from cpsskins import getThemeManager, getContexts
 from cpsskins.browser.negociation.interfaces import INegociation
-from cpsskins.browser.rendering.interfaces import IUpdateData, IFilterView
 from cpsskins.configuration.interfaces import IRegistry
-from cpsskins.elements.interfaces import IType, IRenderer, IFilter
+from cpsskins.elements.interfaces import IType
 from cpsskins.elements.interfaces import IElement, ILeaf, ISlot, IDisplayable
 from cpsskins.relations.interfaces import IPredicate
 from cpsskins.storage.interfaces import IRelationStorage
-from interfaces import IViewer, IRendererView, IFilterView, IContextInfo
+from interfaces import IUpdateData, IViewer, IRendererView, IFilterView
+from interfaces import IContextInfo
+
+from cpsskins import configuration
 from cpsskins.elements.interfaces import INodeTraverser, INode
 
 import logging
@@ -275,13 +277,13 @@
         # look for renderers associated to the element's content type
         iface = IType(element).getContentType()
         name = engine + '.' + iface.__name__  # XXX create a dotted name
-        renderer = queryUtility(IRenderer, name)
+        renderer = queryUtility(configuration.IRenderer, name)
         if renderer is None:
             # fall back to the element type
             iface = IType(element).getElementType()
 
         name = engine + '.' + iface.__name__ # XXX create a dotted name
-        renderer = queryUtility(IRenderer, name)
+        renderer = queryUtility(configuration.IRenderer, name)
         if renderer is None:
             logger.log(INFO,
                 "The element '%s' cannot be rendered by the '%s' engine."
@@ -291,7 +293,7 @@
         filters = []
 
         for filter_name in renderer.filters:
-            filter_proxy = queryUtility(IFilter, filter_name)
+            filter_proxy = queryUtility(configuration.IFilter, filter_name)
             if filter_proxy is None:
                 logger.log(INFO,
                     "Filter '%s' is not registered." % filter_proxy)

Modified: z3lab/cpsskins/branches/jmo-perspectives/configuration/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/__init__.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/__init__.py  Sat Nov 
 5 22:48:10 2005
@@ -25,7 +25,15 @@
 
 from interfaces import IRegistry
 
-class ConfigurationRegistry:
+from displays.display import IDisplay, Display
+from engines.engine import IEngine, Engine
+from formats.format import IFormat, Format
+from filters.filter import IFilter, Filter
+from presentations.presentation import IPresentation, Presentation
+from renderers.renderer import IRenderer, Renderer
+from widgets.widget import IWidget, Widget
+
+class ConfigurationRegistry(object):
     """Configuration registry
 
     Stores configuration settings.

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml 
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml 
Sat Nov  5 22:48:10 2005
@@ -6,7 +6,7 @@
     <complexDirective
         name="accesskeys"
         schema=".metadirectives.IAccessKeysDirective"
-        handler=".metaconfigure.AccessKeyCollection">
+        handler=".metaconfigure.AccessKeysDirective">
 
       <subdirective
           name="accesskey"

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
  (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
  Sat Nov  5 22:48:10 2005
@@ -26,7 +26,7 @@
 accesskey_registry = getUtility(IRegistry, 'accesskeys')
 registered = []
 
-class AccessKeyCollection(object):
+class AccessKeysDirective(object):
 
     def __init__(self, _context, name):
         self._context = _context

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/display.py
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/display.py  
Sat Nov  5 22:48:10 2005
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# 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
+
+class IDisplay(Interface):
+    """A display."""
+
+class Display(object):
+
+    implements(IDisplay)
+
+    def __init__(self, factory):
+        self.factory = factory
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/metaconfigure.py
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/displays/metaconfigure.py
    Sat Nov  5 22:48:10 2005
@@ -25,8 +25,9 @@
 from zope.component import queryUtility, provideUtility
 from zope.interface import alsoProvides
 
-from cpsskins.elements.interfaces import IDisplay, IElementType, IDisplayType
-from cpsskins.elements.display import Display
+from cpsskins import configuration
+from cpsskins.elements.interfaces import IElementType, IDisplayType
+from cpsskins.elements.interfaces import IDisplay
 
 def display(_context, name='', schema=None, factory=None):
 
@@ -37,7 +38,7 @@
         raise ConfigurationError(
             "Display names can only contain alphabetic characters.")
 
-    if queryUtility(IDisplay, name) is not None:
+    if queryUtility(configuration.IDisplay, name) is not None:
         raise ConfigurationError, \
             "A display with the name '%s' has already been registered." % name
 
@@ -67,7 +68,8 @@
         )
 
     # register the display
-    provideUtility(Display(factory=factory), IDisplay, name)
+    provideUtility(configuration.Display(factory=factory),
+                   configuration.IDisplay, name)
 
     # set up interface types
     alsoProvides(IDisplay, IElementType)

Added: z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/engine.py
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/engine.py    
Sat Nov  5 22:48:10 2005
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# 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
+
+class IEngine(Interface):
+    """A rendering engine."""
+
+class Engine(object):
+
+    implements(IEngine)
+
+    def __init__(self, accesskeys):
+        self.accesskeys = accesskeys
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py 
    Sat Nov  5 22:48:10 2005
@@ -20,13 +20,13 @@
 from zope.component import queryUtility, provideUtility
 from zope.configuration.exceptions import ConfigurationError
 
-from cpsskins.elements.interfaces import IEngine
-from cpsskins.elements.engine import Engine
+from cpsskins import configuration
 
 def engine(_context, name, accesskeys=[]):
 
-    if queryUtility(IEngine, name) is not None:
+    if queryUtility(configuration.IEngine, name) is not None:
         raise ConfigurationError(
             "The '%s' engine has already been registered." % name)
 
-    provideUtility(Engine(accesskeys=accesskeys), IEngine, name)
+    provideUtility(configuration.Engine(accesskeys=accesskeys),
+                   configuration.IEngine, name)

Added: z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/filter.py
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/filter.py    
Sat Nov  5 22:48:10 2005
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# 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
+
+class IFilter(Interface):
+    """A filter"""
+
+class Filter(object):
+
+    implements(IFilter)
+
+    def __init__(self, name='', predicate=None, factory=None, template=None):
+        self.name = name
+        self.predicate = predicate
+        self.factory = factory
+        self.template = template
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py 
    Sat Nov  5 22:48:10 2005
@@ -24,18 +24,16 @@
 from zope.component import provideAdapter, queryUtility, provideUtility
 from zope.configuration.exceptions import ConfigurationError
 
+from cpsskins import configuration
 from cpsskins.browser.rendering.interfaces import IFilterView
 
 def filter(_context, name='', for_=None, factory=None, predicate=None,
            template='', stylesheet=None):
 
-    from cpsskins.elements.filter import Filter
-    from cpsskins.elements.interfaces import IFilter
-
     if not name:
         raise ConfigurationError("Must specify the filter name.")
 
-    if queryUtility(IFilter, name) is not None:
+    if queryUtility(configuration.IFilter, name) is not None:
         raise ConfigurationError, \
             "A filter with the name '%s' has already been registered." % name
 
@@ -54,14 +52,16 @@
             discriminator = ('adapter', factory, for_, name),
             callable = provideAdapter,
             args = (factory, (for_,), IFilterView, name))
-        provideUtility(Filter(name=name, predicate=predicate), IFilter, name)
+        provideUtility(configuration.Filter(name=name, predicate=predicate),
+                       configuration.IFilter, name)
 
     # factory
     elif factory:
         if template or for_:
             raise ConfigurationError(
                 "With a factory, cannot specify a template or an interface.")
-        provideUtility(Filter(name=name, factory=factory), IFilter, name)
+        provideUtility(configuration.Filter(name=name, factory=factory),
+                       configuration.IFilter, name)
 
     # template
     elif template:
@@ -69,7 +69,8 @@
             raise ConfigurationError(
                 "With a template, cannot specify an interface")
         template = pagetemplate.ViewPageTemplateFile(template)
-        provideUtility(Filter(name=name, template=template), IFilter, name)
+        provideUtility(configuration.Filter(name=name, template=template),
+                       configuration.IFilter, name)
 
     # register resources
     if stylesheet:

Added: z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/format.py
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/format.py    
Sat Nov  5 22:48:10 2005
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# 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
+
+class IFormat(Interface):
+    """A format."""
+
+class Format(object):
+
+    implements(IFormat)
+
+    def __init__(self, id=u'', factory=None, predicate=None):
+        self.id = id
+        self.factory = factory
+        self.predicate = predicate
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/formats/metaconfigure.py 
    Sat Nov  5 22:48:10 2005
@@ -27,8 +27,8 @@
 from zope.component import queryUtility, provideUtility
 from zope.interface import alsoProvides
 
-from cpsskins.elements.interfaces import IFormat, IElementType
-from cpsskins.elements.format import Format
+from cpsskins import configuration
+from cpsskins.elements.interfaces import IElementType, IFormat
 from cpsskins.ontology import FormatPredicate, IFormatPredicate
 
 def getAbsolutePath(_context, file):
@@ -47,7 +47,7 @@
     if not (schema or factory or template):
         raise ConfigurationError("Format information is missing.")
 
-    if queryUtility(IFormat, name) is not None:
+    if queryUtility(configuration.IFormat, name) is not None:
         raise ConfigurationError, \
             "A format with the name '%s' has already been registered." % name
 
@@ -84,7 +84,8 @@
         )()
 
     # register the format
-    provideUtility(Format(factory=factory, predicate=predicate), IFormat, name)
+    provideUtility(configuration.Format(factory=factory, predicate=predicate),
+                   configuration.IFormat, name)
 
     # register the predicate
     provideUtility(FormatPredicate(predicate), IFormatPredicate, name)

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/portlets/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/portlets/__init__.py 
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/portlets/__init__.py 
Sat Nov  5 22:48:10 2005
@@ -16,6 +16,3 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
-# make this directory a package
-
-pass

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
       (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
       Sat Nov  5 22:48:10 2005
@@ -21,8 +21,7 @@
 from zope.configuration.exceptions import ConfigurationError
 from zope.i18nmessageid import MessageFactory
 
-from cpsskins.elements.presentation import Presentation
-from cpsskins.elements.interfaces import IPresentation
+from cpsskins import configuration
 
 _ = MessageFactory("cpsskins")
 
@@ -44,7 +43,7 @@
 
         name = str(self.for_)
 
-        if queryUtility(IPresentation, name) is not None:
+        if queryUtility(configuration.IPresentation, name) is not None:
             raise ConfigurationError(
                 "A presentation has already been registered for the"
                 "interface %s" % self.for_)
@@ -52,7 +51,7 @@
         if not self._display:
             raise ConfigurationError("Must specify a display type.")
 
-        provideUtility(
-            Presentation(display=self._display, formats=self._formats),
-            IPresentation, name)
+        provideUtility(configuration.Presentation(display=self._display,
+                       formats=self._formats), configuration.IPresentation,
+                       name)
 

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/presentation.py
==============================================================================
--- (empty file)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/presentation.py
        Sat Nov  5 22:48:10 2005
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# 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
+
+class IPresentation(Interface):
+    """A Presentation."""
+
+class Presentation(object):
+
+    implements(IPresentation)
+
+    def __init__(self, display=None, formats=[]):
+        self.display = display
+        self.formats = formats
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/__init__.py    
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/__init__.py    
    Sat Nov  5 22:48:10 2005
@@ -17,9 +17,3 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.component import provideUtility
-
-from cpsskins.configuration import ConfigurationRegistry
-from cpsskins.configuration.interfaces import IRegistry
-
-provideUtility(ConfigurationRegistry(), IRegistry, 'renderers')

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/metaconfigure.py
   (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/metaconfigure.py
   Sat Nov  5 22:48:10 2005
@@ -23,11 +23,9 @@
 from zope.i18nmessageid import MessageFactory
 from zope.publisher.interfaces.browser import IBrowserRequest
 
-from cpsskins.configuration.interfaces import IRegistry
+from cpsskins import configuration
 from cpsskins.browser.rendering.engine import RendererView
 from cpsskins.browser.rendering.interfaces import IRendererView
-from cpsskins.elements.renderer import Renderer
-from cpsskins.elements.interfaces import IRenderer
 
 _ = MessageFactory("cpsskins")
 
@@ -50,7 +48,8 @@
 
         for iface in self.for_:
             name = engine + '.' + iface.__name__ # XXX create a dotted name
-            provideUtility(Renderer(filters=self.filters), IRenderer, name)
+            provideUtility(configuration.Renderer(filters=self.filters),
+                           configuration.IRenderer, name)
 
 def renderer(_context, engine, for_):
 

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/renderer.py
==============================================================================
--- (empty file)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/renderer.py    
    Sat Nov  5 22:48:10 2005
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# 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 Tokens
+from zope.interface import implements, Interface
+
+class IRenderer(Interface):
+    """Renderers should implement this"""
+
+    filters = Tokens(
+        title=u"Filters associated to the filter.")
+
+class Renderer(object):
+
+    implements(IRenderer)
+
+    def __init__(self, filters):
+        self.filters = filters
+

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py 
    Sat Nov  5 22:48:10 2005
@@ -23,10 +23,9 @@
 from zope.i18nmessageid import MessageFactory
 from zope.publisher.interfaces.browser import IBrowserRequest
 
-from cpsskins.configuration.interfaces import IRegistry
-from cpsskins.engines.default.formats.interfaces import IWidget
-from cpsskins.engines.default.formats.widget import Widget
+from cpsskins import configuration
 from cpsskins.filters.interfaces import IWidgetView
+from cpsskins.engines.default.formats.interfaces import IWidget
 
 _ = MessageFactory("cpsskins")
 
@@ -44,9 +43,10 @@
         raise ConfigurationError("Must specify a widget factory.")
 
     # register widgets
-    provideUtility(Widget(id=id, title=title, factory=factory), IWidget, id)
+    provideUtility(configuration.Widget(id=id, title=title, factory=factory),
+                   configuration.IWidget, id)
 
     # zope:adapter
     adapter(_context=_context, factory=(factory,), provides=IWidgetView,
-        for_=(IWidget, IBrowserRequest), name=id)
+            for_=(IWidget, IBrowserRequest), name=id)
 

Added: z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py    
Sat Nov  5 22:48:10 2005
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# 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, Attribute, Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import Choice, TextLine
+
+_ = MessageFactory("cpsskins")
+
+class IWidget(Interface):
+    """A presentation widget"""
+
+    id = Choice(
+        title=_("Widget"),
+        description=_("A widget for displaying content"),
+        vocabulary="Widgets",
+        )
+
+    title = TextLine(
+        title=_("Widget title"),
+        )
+
+    type = Attribute(u"Widget type")
+
+    factory = Attribute(u"Widget factory")
+
+class Widget(object):
+    """A widget.
+    """
+    implements(IWidget)
+
+    def __init__(self, id=u'', title=u'', type=None, factory=None):
+        self.id = id
+        self.title = title
+        self.type = type
+        self.factory = factory
+

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/display.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/display.py        
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/display.py        Sat Nov 
 5 22:48:10 2005
@@ -25,9 +25,7 @@
 from zope.interface import implements
 from zope.security.proxy import removeSecurityProxy
 
-from cpsskins.elements.interfaces import IPresentation
-
-from cpsskins.configuration.interfaces import IRegistry
+from cpsskins import configuration
 from cpsskins.elements import Element
 from cpsskins.elements.interfaces import IType
 from cpsskins.perspectives.interfaces import IPerspective
@@ -42,9 +40,6 @@
 
     implements(IDisplay)
 
-    def __init__(self, factory=None):
-        self.factory = factory
-
     def __iter__(self):
         return iter([])
 
@@ -220,12 +215,12 @@
         """
         context = self.context
 
-        presentation = queryUtility(IPresentation,
+        presentation = queryUtility(configuration.IPresentation,
                                     str(IType(context).getContentType()))
         if presentation is None:
-            presentation = queryUtility(IPresentation,
+            presentation = queryUtility(configuration.IPresentation,
                                         str(IType(context).getElementType()))
 
-        display = getUtility(IDisplay, presentation.display)
+        display = getUtility(configuration.IDisplay, presentation.display)
         return apply(display.factory, ())
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/format.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/format.py (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/format.py Sat Nov  5 
22:48:10 2005
@@ -24,6 +24,7 @@
 from zope.interface import implements
 from zope.security.proxy import removeSecurityProxy
 
+from cpsskins import configuration
 from cpsskins.elements import Element
 from cpsskins.elements.interfaces import IType, IFormat, IFormattable
 from cpsskins.ontology import hasFormat
@@ -36,10 +37,8 @@
 
     implements(IFormat)
 
-    def __init__(self, id=u'', factory=None, predicate=None):
+    def __init__(self, id=u''):
         self.id = id
-        self.factory = factory
-        self.predicate = predicate
 
     def _getFormatName(self):
         return IType(self).getContentType().getTaggedValue('name')
@@ -97,7 +96,7 @@
     def traverse(self, name, remaining):
         context = self.context
         # get a format by name
-        if queryUtility(IFormat, name) is not None:
+        if queryUtility(configuration.IFormat, name) is not None:
             return self.getFormat(name)
         # return a method of the adapter
         return getattr(self, name)
@@ -117,7 +116,7 @@
     def getFormats(self, name=u''):
         context = self.context
         reltool = RelationTool(context)
-        format = queryUtility(IFormat, name)
+        format = queryUtility(configuration.IFormat, name)
         predicate = format and format.predicate or hasFormat
         return reltool.getSeconds(first=context, predicate=predicate)
 
@@ -148,7 +147,8 @@
         context = self.context
         reltool = RelationTool(context)
 
-        predicate = getUtility(IFormat, format.formatname).predicate
+        predicate = getUtility(configuration.IFormat,
+                               format.formatname).predicate
         relations = reltool.search(first=context, predicate=predicate)
         reltool.remove(relations)
 
@@ -166,6 +166,6 @@
         """Display factory. Return a display element.
         """
         context = self.context
-        factory = getUtility(IFormat, name).factory
-        return apply(factory, (), {'id': id})
+        factory = getUtility(configuration.IFormat, name).factory
+        return factory(id=id)
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/interfaces.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/interfaces.py     
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/interfaces.py     Sat Nov 
 5 22:48:10 2005
@@ -63,10 +63,8 @@
         """Return the list of child nodes
         """
 
-# The properties of elements
-
 class IDisplay(IElement):
-    pass
+    """A display element"""
 
 class IDisplayable(Interface):
 
@@ -107,14 +105,7 @@
 
 class IFormat(IElement):
 
-    formatname = TextLine(
-        title=u'Format name',
-        required=False,
-        readonly=True)
-
-    predicate = Attribute(u"The format's predicate")
-
-    factory = Attribute(u"The format's factory")
+    formatname = Attribute(u"Format name")
 
     def findDisplays():
         """ """
@@ -142,21 +133,6 @@
     def storeFormat(format):
         """Add a format to the format storage."""
 
-class IEngine(Interface):
-    """A rendering engine."""
-
-class IRenderer(Interface):
-    """Renderers should implement this"""
-
-    filters = Tokens(
-        title=u"Filters associated to the filter.")
-
-class IFilter(Interface):
-    """A filter"""
-
-class IPresentation(Interface):
-    """A Presentation."""
-
 class IPresentable(Interface):
     """Presentable elements can be displayed and formatted."""
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py   
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py   Sat Nov 
 5 22:48:10 2005
@@ -21,21 +21,13 @@
 from zope.interface import implements
 from zope.component import getUtility, queryUtility
 
+from cpsskins import configuration
 from cpsskins.elements.interfaces import IType, IDisplayable, IFormattable
-from cpsskins.elements.interfaces import IPresentation
 from cpsskins.ontology import hasFormat, hasDisplay, hasDisplayFromPerspective
 from cpsskins.relations.tool import RelationTool
 from cpsskins.thememanager import getThemeManager
 from interfaces import IPresentable
 
-class Presentation(object):
-
-    implements(IPresentation)
-
-    def __init__(self, display=None, formats=[]):
-        self.display = display
-        self.formats = formats
-
 class Presentable(object):
     """This adapter makes elements presentable, i.e. displayable and 
formattable
     according to the factory settings.
@@ -65,10 +57,10 @@
 
         formattable = IFormattable(display)
 
-        factory_info = queryUtility(IPresentation,
+        factory_info = queryUtility(configuration.IPresentation,
                                     str(IType(context).getContentType()))
         if factory_info is None:
-            factory_info = queryUtility(IPresentation,
+            factory_info = queryUtility(configuration.IPresentation,
                                     str(IType(context).getElementType()))
         for type, id in factory_info.formats.items():
             formattable.addFormat(type, id)

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/__init__.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/__init__.py  
Sat Nov  5 22:48:10 2005
@@ -17,8 +17,8 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.engines.interfaces import IEngine
+from cpsskins.engines.interfaces import IEngineType
 from cpsskins.engines.authoring.authoring import Authoring
 
-class IContentAuthoring(IEngine):
+class IContentAuthoring(IEngineType):
     """A rendering engine for content authoring"""

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/filters/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/filters/__init__.py
  (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/engines/contentauthor/filters/__init__.py
  Sat Nov  5 22:48:10 2005
@@ -17,9 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.engines.interfaces import IEngine
+from cpsskins.engines.interfaces import IEngineType
 from cpsskins.engines.authoring.authoring import Authoring
 
-class IPageAuthoring(IEngine):
+class IPageAuthoring(IEngineType):
     """A rendering engine for page authoring"""
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/layout/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/layout/__init__.py
 (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/layout/__init__.py
 Sat Nov  5 22:48:10 2005
@@ -52,9 +52,6 @@
     >>> class FakeLayout(BTreeContainer):
     ...    def __init__(self, type='plain'):
     ...        BTreeContainer.__init__(self)
-    ...        self._type = type
-    ...    def getLayoutType(self):
-    ...        return self._type
 
     >>> l = FakeLayout('plain')
     >>> l['padding'] = ''

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/layout.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/layout.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/layout.py  
Sat Nov  5 22:48:10 2005
@@ -35,12 +35,6 @@
     def traverse(name, remaining):
        """Get a layout attribute by traversal."""
 
-    def getLayoutId():
-       """Return the layout id"""
-
-    def getLayoutType():
-       """Return the layout type"""
-
 class ILayoutType(IInterface):
     """The layout type categorizes layout elements."""
 
@@ -83,7 +77,7 @@
         self._resetFields()
 
     def __repr__(self):
-        return "Layout('%s')" % self.getLayoutId()
+        return "Layout('%s')" % self.id
 
     def traverse(self, name, remaining):
         if name in self._getAllowedKeys():
@@ -106,12 +100,9 @@
             self[k] = ''
 
     def _getAllowedKeys(self):
-        layout_id = self.getLayoutId()
+        layout_id = self.id
         return layouts[layout_id].keys()
 
-    def getLayoutId(self):
-        return self.id
-
     def factory(self, type='', id=''):
         """Display factory. Return a display element.
         """

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/widget.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/widget.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/default/formats/widget.py  
Sat Nov  5 22:48:10 2005
@@ -44,15 +44,6 @@
         vocabulary="Widgets",
         )
 
-    # TODO: to refactor
-    title = TextLine(
-        title=_("Widget title"),
-        )
-
-    type = Attribute(u"Widget type")
-
-    factory = Attribute(u"Widget factory")
-
 class Widget(Format, Persistent):
     """A presentation element is used to present data with help of widgets.
 
@@ -62,11 +53,9 @@
     """
     implements(IWidget)
 
-    def __init__(self, id=u'', title=u'', type=None, factory=None):
+    def __init__(self, id=u'', title=u''):
         self.id = id
         self.title = title
-        self.type = type
-        self.factory = factory
 
     def __repr__(self):
         return "Widget('%s')" % self.id

Modified: z3lab/cpsskins/branches/jmo-perspectives/engines/interfaces.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/interfaces.py      
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/interfaces.py      Sat Nov 
 5 22:48:10 2005
@@ -20,6 +20,6 @@
 
 from zope.interface.interfaces import IInterface
 
-class IEngine(IInterface):
+class IEngineType(IInterface):
     """A type interface for identifying engines"""
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/layoutdesigner/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/layoutdesigner/__init__.py 
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/layoutdesigner/__init__.py 
Sat Nov  5 22:48:10 2005
@@ -17,9 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.engines.interfaces import IEngine
+from cpsskins.engines.interfaces import IEngineType
 from cpsskins.engines.authoring.authoring import Authoring
 
-class IPageAuthoring(IEngine):
+class IPageAuthoring(IEngineType):
     """A rendering engine for page authoring"""
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/__init__.py   
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/__init__.py   
Sat Nov  5 22:48:10 2005
@@ -17,10 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.engines.interfaces import IEngine
-
+from cpsskins.engines.interfaces import IEngineType
 from cpsskins.engines.authoring.authoring import Authoring
 
-class IPageAuthoring(IEngine):
+class IPageAuthoring(IEngineType):
     """A rendering engine for page authoring"""
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/filters/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/filters/__init__.py
   (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/engines/pagedesigner/filters/__init__.py
   Sat Nov  5 22:48:10 2005
@@ -17,9 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from cpsskins.engines.interfaces import IEngine
+from cpsskins.engines.interfaces import IEngineType
 from cpsskins.engines.authoring.authoring import Authoring
 
-class IPageAuthoring(IEngine):
+class IPageAuthoring(IEngineType):
     """A rendering engine for page authoring"""
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to