Author: jmorliaguet
Date: Tue Apr 11 20:08:35 2006
New Revision: 2818

Modified:
   
cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
   
cpsskins/branches/jmo-perspectives/configuration/presentations/metadirectives.py
   cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
   cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py
   cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
   cpsskins/branches/jmo-perspectives/elements/configure.zcml
   cpsskins/branches/jmo-perspectives/elements/format.py
   cpsskins/branches/jmo-perspectives/elements/interfaces.py
   cpsskins/branches/jmo-perspectives/elements/presentation.py
   cpsskins/branches/jmo-perspectives/standard/ds/image.py
   cpsskins/branches/jmo-perspectives/standard/ds/item.py
   cpsskins/branches/jmo-perspectives/standard/ds/items.py
   cpsskins/branches/jmo-perspectives/standard/ds/metadata.py
   cpsskins/branches/jmo-perspectives/standard/filters/widget/__init__.py
   cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.py
   cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml
   cpsskins/branches/jmo-perspectives/standard/formats/effect.py
   cpsskins/branches/jmo-perspectives/standard/formats/layout.py
   cpsskins/branches/jmo-perspectives/standard/formats/style.py
   cpsskins/branches/jmo-perspectives/standard/formats/widget.py
   cpsskins/branches/jmo-perspectives/standard/portlets/actions/configure.zcml
   
cpsskins/branches/jmo-perspectives/standard/portlets/breadcrumbs/configure.zcml
   cpsskins/branches/jmo-perspectives/standard/portlets/custom/configure.zcml
   cpsskins/branches/jmo-perspectives/standard/portlets/dummy/configure.zcml
   cpsskins/branches/jmo-perspectives/standard/portlets/dummy/portlet.py
   cpsskins/branches/jmo-perspectives/standard/portlets/image/configure.zcml
   cpsskins/branches/jmo-perspectives/standard/portlets/macroslot/configure.zcml
Log:

- refactoring of the datastructure <-> widget relation to support fallback
  values.



Modified: 
cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py 
    (original)
+++ 
cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py 
    Tue Apr 11 20:08:35 2006
@@ -37,8 +37,8 @@
     def display(self, _context, type):
         self._display = type
 
-    def format(self, _context, name, type=u''):
-        self._formats[name] = type
+    def format(self, _context, name, types=[]):
+        self._formats[name] = types
 
     def __call__(self):
 

Modified: 
cpsskins/branches/jmo-perspectives/configuration/presentations/metadirectives.py
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/configuration/presentations/metadirectives.py
    (original)
+++ 
cpsskins/branches/jmo-perspectives/configuration/presentations/metadirectives.py
    Tue Apr 11 20:08:35 2006
@@ -17,7 +17,7 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.configuration.fields import GlobalObject
+from zope.configuration.fields import GlobalObject, Tokens
 from zope.interface import Interface
 from zope.i18nmessageid import MessageFactory
 from zope.schema import TextLine
@@ -49,9 +49,10 @@
         required=False,
        )
 
-    type = TextLine(
-        title=_(u"Type"),
-        description=_(u"The format's type id."),
+    types = Tokens(
+        title=_(u"Format types"),
+        description=_(u"The format type names."),
         required=False,
+        value_type=TextLine(),
        )
 

Modified: 
cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py   
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py   
Tue Apr 11 20:08:35 2006
@@ -29,7 +29,7 @@
 
 _ = MessageFactory("cpsskins")
 
-def widget(_context=None, type=None, title=None, view=None):
+def widget(_context=None, type=None, title=None, view=None, for_=None):
 
     if not type:
         raise ConfigurationError("Must specify the widget type.")
@@ -46,5 +46,5 @@
 
     # zope:adapter
     adapter(_context=_context, factory=(view,), provides=IWidgetView,
-            for_=(IWidget, IBrowserRequest), name=type)
+            for_=(for_, IBrowserRequest), name=type)
 

Modified: 
cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py  
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py  
Tue Apr 11 20:08:35 2006
@@ -28,7 +28,7 @@
 
     type = TextLine(
         title=_(u"Type"),
-        description=_(u"The widget type."),
+        description=_(u"The widget type's name."),
         required=False,
         default=u'',
         )
@@ -46,3 +46,10 @@
         required=False,
         )
 
+    for_ = GlobalObject(
+        title=_(u"Data structure type"),
+        description=_(u"The type of data structure that the widget provides "
+                       "a view for."),
+        required=False,
+        )
+

Modified: cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt        
(original)
+++ cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt        Tue Apr 
11 20:08:35 2006
@@ -22,13 +22,13 @@
     u'Example portlet'
 
 
-Rendering is done in three steps:
------------------------------------
+The rendering of a portlet is done in three steps
+-------------------------------------------------
 
 1) a portlet has some data to display, called the 'Display Data'.
-   it corresponds to the data model in the Model-View-Controller paradigm.
+   it corresponds to the model in the Model-View-Controller paradigm.
 
-   to obtain the data, the portlet's __call__() method is called:
+   to obtain data from the portlet the __call__() method is used:
 
     >>> from cpsskins.browser.rendering.context import ContextInfo
     >>> info = ContextInfo({'data': None, 'metadata': None})
@@ -40,7 +40,7 @@
 
    the actual content of the display data is either:
 
-   - a list of menu items (items.Items, item.Item)
+   - a list of items (items.Items, item.Item)
 
     >>> from cpsskins.standard.ds.item import Item
     >>> from cpsskins.standard.ds.items import Items
@@ -59,7 +59,7 @@
    - ...
 
 
-2) the data is displayed with a Display Element, (here: a box) :
+2) the data is displayed in a Display Element, (here: a box) :
    it corresponds to the 'view' in the MVC paradigm.
 
     >>> from zope.interface.verify import verifyClass
@@ -75,15 +75,15 @@
     >>> verifyClass(IFormat, Widget)
     True
 
-    >>> widget = Widget('plain_html')
+    >>> widget = Widget([u'plain'])
 
 
 3) The portlet is finally rendered by passing the data to the filter
    (here a widget filter):
 
-    >>> rendered = u'<h1>Test of HTML</h1>'
+    >>> rendered = u'<div><h1>Test of HTML</h1></div>'
 
-the widget filter adapts the widget providing a view:
+the widget filter adapts the data structure for providing a view:
 
     >>> from cpsskins.standard.filters.widget import WidgetFilter
     >>> from cpsskins.standard.formats.widget import IWidget
@@ -110,31 +110,31 @@
 
     a) vertical menu
     ----------------
-    >>> widget = Widget('vertical_menu')
+    >>> widget = Widget([u'vertical_menu'])
     >>> test_render(widget, rendered, info)
     u'<ul class="verticalMenu"><li><a href="@@urlA.html">Item A</a></li><li><a 
href="@@urlB.html">Item B</a></li></ul>'
 
     b) horizontal tabs
     ------------------
-    >>> widget = Widget('horizontal_tabs')
+    >>> widget = Widget([u'horizontal_tabs'])
     >>> test_render(widget, rendered, info)
     u'<ul class="horizontalTabs"><li><a href="@@urlA.html">Item 
A</a></li><li><a href="@@urlB.html">Item B</a></li></ul>'
 
     c) Menu bar
     -------------------
-    >>> widget = Widget('menu_bar')
+    >>> widget = Widget([u'menu_bar'])
     >>> test_render(widget, rendered, info)
     u'<div class="menuBar"><a href="@@urlA.html">Item A</a><a 
href="@@urlB.html">Item B</a></div>'
 
     d) Horizontal trail
     -------------------
-    >>> widget = Widget('horizontal_trail')
+    >>> widget = Widget([u'horizontal_trail'])
     >>> test_render(widget, rendered, info)
     u'<div class="horizontalTrail"><a href="@@urlA.html">Item A</a><span 
class="sep">&gt;</span><a href="@@urlB.html">Item B</a><span 
class="sep">&gt;</span></div>'
 
     e) Drop-down list
     -----------------
-    >>> widget = Widget('dropdown_list')
+    >>> widget = Widget([u'dropdown_list'])
     >>> test_render(widget, rendered, info)
     u'<form action="@@cpsskins_redirect" method="post"><select 
onchange="submit()" name="url"><option value="./"></option><option 
value="@@urlA.html">Item A</option><option value="@@urlB.html">Item 
B</option></select></form>'
 
@@ -148,37 +148,37 @@
     ------------
     >>> from cpsskins.standard.ds.metadata import MetaData
     >>> info.metadata = MetaData(title=u'Example frame box')
-    >>> widget = Widget('frame_box')
+    >>> widget = Widget([u'frame_box'])
     >>> test_render(widget, rendered, info)
     u'<fieldset><legend>Example frame box</legend><div><h1>Test of 
HTML</h1></div></fieldset>'
 
     b) horizontal scrollbar
     -----------------------
-    >>> widget = Widget('horizontal_scrollbar')
+    >>> widget = Widget([u'horizontal_scrollbar'])
     >>> test_render(widget, rendered, info)
     u'<div style="overflow-x:scroll;"><h1>Test of HTML</h1></div>'
 
     c) table frame
     --------------
-    >>> widget = Widget('table_frame')
+    >>> widget = Widget([u'table_frame'])
     >>> test_render(widget, rendered, info)
     u'<table summary=""><tr><h1>Test of HTML</h1></tr></table>'
 
     d) table cell
     --------------
-    >>> widget = Widget('table_cell')
+    >>> widget = Widget([u'table_cell'])
     >>> test_render(widget, rendered, info)
     u'<td style="vertical-align:top;"><h1>Test of HTML</h1></td>'
 
     e) div frame (tableless renderering)
     ------------------------------------
-    >>> widget = Widget('div_frame')
+    >>> widget = Widget([u'div_frame'])
     >>> test_render(widget, rendered, info)
     u'<div><h1>Test of HTML</h1><br style="clear:left"/></div><div 
style="clear:left"></div>'
 
     f) div cell (tableless rendering)
     ---------------------------------
-    >>> widget = Widget('div_cell')
+    >>> widget = Widget([u'div_cell'])
     >>> test_render(widget, rendered, info)
     u'<div style="float:left;overflow-x:hidden"><h1>Test of HTML</h1></div>'
 
@@ -191,7 +191,7 @@
 
     a) image
     --------
-    >>> widget = Widget('image')
+    >>> widget = Widget([u'image'])
     >>> test_render(widget, rendered, info)
     u'<img src="/some/image.png" alt="" style="border: none" />'
 

Modified: cpsskins/branches/jmo-perspectives/elements/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/configure.zcml  (original)
+++ cpsskins/branches/jmo-perspectives/elements/configure.zcml  Tue Apr 11 
20:08:35 2006
@@ -211,12 +211,12 @@
 
     <cpsskins:format
         name="layout"
-        type="page"
+        types="page"
     />
 
     <cpsskins:format
         name="widget"
-        type="page_body"
+        types="page_body"
     />
 
     <cpsskins:format
@@ -268,12 +268,12 @@
 
     <cpsskins:format
         name="layout"
-        type="container"
+        types="container"
     />
 
     <cpsskins:format
         name="widget"
-        type="table_frame"
+        types="table_frame"
     />
 
     <cpsskins:format
@@ -326,12 +326,12 @@
 
     <cpsskins:format
         name="layout"
-        type="container"
+        types="container"
     />
 
     <cpsskins:format
         name="widget"
-        type="table_cell"
+        types="table_cell"
     />
 
     <cpsskins:format
@@ -390,12 +390,12 @@
 
     <cpsskins:format
         name="effect"
-        type="scale"
+        types="scale"
     />
 
     <cpsskins:format
         name="widget"
-        type="frame_box"
+        types="frame_box"
     />
 
     <cpsskins:format
@@ -428,7 +428,7 @@
 
     <cpsskins:format
         name="widget"
-        type="plain_html"
+        types="plain_html"
     />
 
     <cpsskins:format

Modified: cpsskins/branches/jmo-perspectives/elements/format.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/format.py       (original)
+++ cpsskins/branches/jmo-perspectives/elements/format.py       Tue Apr 11 
20:08:35 2006
@@ -35,10 +35,10 @@
 
     implements(IFormat)
 
-    type = u''
+    types = []
 
-    def __init__(self, type=u''):
-        self.type = type
+    def __init__(self, types=[]):
+        self.types = types
 
     def findDisplays(self):
         """Return the list of display elements associated to this
@@ -133,9 +133,9 @@
         names.sort()
         return names
 
-    def addFormat(self, name=u'', type=u''):
+    def addFormat(self, name=u'', types=[]):
         format = createObject(name)
-        format.type = type
+        format.types = types
         self.storeFormat(format)
         return self.setFormat(format)
 

Modified: cpsskins/branches/jmo-perspectives/elements/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/interfaces.py   (original)
+++ cpsskins/branches/jmo-perspectives/elements/interfaces.py   Tue Apr 11 
20:08:35 2006
@@ -128,7 +128,7 @@
 
 class IFormat(IElement):
 
-    type = Attribute("The type of format.")
+    types = Attribute("The format types.")
 
     def findDisplays():
         """ """

Modified: cpsskins/branches/jmo-perspectives/elements/presentation.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/presentation.py (original)
+++ cpsskins/branches/jmo-perspectives/elements/presentation.py Tue Apr 11 
20:08:35 2006
@@ -63,8 +63,8 @@
         if factory_info is None:
             factory_info = queryUtility(configuration.IPresentation,
                                         IType(context).elementname)
-        for name, type in factory_info.formats.items():
-            formattable.addFormat(name=name, type=type)
+        for name, types in factory_info.formats.items():
+            formattable.addFormat(name=name, types=types)
 
     def clonePresentation(self, perspective=None):
         """Clone the default presentation of an element.

Modified: cpsskins/branches/jmo-perspectives/standard/ds/image.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/ds/image.py     (original)
+++ cpsskins/branches/jmo-perspectives/standard/ds/image.py     Tue Apr 11 
20:08:35 2006
@@ -43,7 +43,7 @@
         required=False,
         )
 
-IImage.setTaggedValue('name', 'image')
+IImage.setTaggedValue('name', u'image')
 
 class Image(object):
     """An image.

Modified: cpsskins/branches/jmo-perspectives/standard/ds/item.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/ds/item.py      (original)
+++ cpsskins/branches/jmo-perspectives/standard/ds/item.py      Tue Apr 11 
20:08:35 2006
@@ -64,7 +64,7 @@
         required=False,
         )
 
-IItem.setTaggedValue('name', 'item')
+IItem.setTaggedValue('name', u'item')
 
 class Item(object):
     """Some item

Modified: cpsskins/branches/jmo-perspectives/standard/ds/items.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/ds/items.py     (original)
+++ cpsskins/branches/jmo-perspectives/standard/ds/items.py     Tue Apr 11 
20:08:35 2006
@@ -40,7 +40,7 @@
         required=False,
         )
 
-IItems.setTaggedValue('name', 'item')
+IItems.setTaggedValue('name', u'item')
 
 class Items(object):
     """A list of menu items

Modified: cpsskins/branches/jmo-perspectives/standard/ds/metadata.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/ds/metadata.py  (original)
+++ cpsskins/branches/jmo-perspectives/standard/ds/metadata.py  Tue Apr 11 
20:08:35 2006
@@ -49,7 +49,7 @@
         required=False,
         )
 
-IMetaData.setTaggedValue('name', 'metadata')
+IMetaData.setTaggedValue('name', u'metadata')
 
 class MetaData(object):
     """Meta-data structure

Modified: cpsskins/branches/jmo-perspectives/standard/filters/widget/__init__.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/filters/widget/__init__.py      
(original)
+++ cpsskins/branches/jmo-perspectives/standard/filters/widget/__init__.py      
Tue Apr 11 20:08:35 2006
@@ -28,7 +28,7 @@
 from cpsskins.browser.rendering.interfaces import IFilterView
 from cpsskins.standard.formats.widget import IWidget
 from cpsskins.standard.filters.widget.interfaces import (
-                                                 IBasicWidgetView, IWidgetView)
+                                      IBasicWidgetView, IWidgetView)
 
 logger = logging.getLogger("cpsskins")
 
@@ -49,29 +49,27 @@
         context = self.context
         request = info.globals.request
 
-        widget_type = context.type
-        if not widget_type:
-            logger.warning("'%s' cannot be displayed. Widget '%s' is unknown.",
-                           repr(info.element), widget_type)
-            return markup
-
         data = info.data
 
-        factory = queryMultiAdapter(
-            objects=(context, request),
-            interface=IWidgetView,
-            name=widget_type,
-            )
+        types = context.types
+        for type in types:
+            factory = queryMultiAdapter((data, request), IWidgetView,
+                                         name=type)
+            if factory is not None:
+                break
 
         if factory is None:
             logger.warning("'%s' with data '%s' could not be displayed "
-                           "with the specified widget ('%s'). "
+                           "with the specified widget. "
                            "Falling back to the basic widget view.",
-                           repr(info.element), repr(data), widget_type)
+                           repr(info.element), repr(data))
+
             factory = queryMultiAdapter(objects=(data, request),
                                         interface=IBasicWidgetView)
 
             if factory is None:
+                logger.warning("No basic widget view found for '%s'.",
+                                repr(info.element))
                 return markup
 
         return factory(markup=markup, info=info)

Modified: cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.py       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.py       
Tue Apr 11 20:08:35 2006
@@ -19,7 +19,7 @@
 
 from cpsskins.standard.filters.widget import WidgetView
 
-# Base classes divided into categories.
+# Base widget views
 
 class HTMLView(WidgetView):
     """Simple HTML markup wrapped around some content.
@@ -32,7 +32,7 @@
         return markup
 
 class MenuView(WidgetView):
-    """A menu view display a list of clickable items.
+    """A menu view displays a list of items.
     """
     _start = ''     # Optional
     _repeat = ''    # Mandatory
@@ -62,12 +62,10 @@
         return ''.join(markup)
 
 
-# The actual widget views
-
-# Basic views
+# Basic views to fall back to
 
 class BasicHTMLView(WidgetView):
-    """Display the data with minimal formatting.
+    """Display the markup with minimal formatting
     """
 
     _preview = u'<div>' \
@@ -102,11 +100,11 @@
         markup = []
         items_append = markup.append
         for item in data:
-            items_append('<a href="%s">%s</a>' % (item.url, item.title))
+            items_append(u'<a href="%s">%s</a>' % (item.url, item.title))
         return u''.join(markup)
 
 
-# Advanced views
+# The actual widget views
 
 class Image(WidgetView):
     """Display an image

Modified: 
cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml     
(original)
+++ cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml     
Tue Apr 11 20:08:35 2006
@@ -13,18 +13,21 @@
   <widget
       type="plain_image"
       view=".widgets.BasicImageView"
+      for="cpsskins.standard.ds.image.IImage"
       title="Basic image view"
   />
 
   <widget
       type="plain_item"
       view=".widgets.BasicItemView"
+      for="cpsskins.standard.ds.item.IItem"
       title="Basic item view"
   />
 
   <widget
       type="plain_items"
       view=".widgets.BasicItemsView"
+      for="cpsskins.standard.ds.items.IItems"
       title="Basic items view"
   />
 
@@ -80,30 +83,35 @@
       type="vertical_menu"
       title="Vertical menu"
       view=".widgets.VerticalMenu"
+      for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
       type="horizontal_tabs"
       title="Horizontal tabs"
       view=".widgets.HorizontalTabs"
+      for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
       type="menu_bar"
       title="Menu bar"
       view=".widgets.MenuBar"
+      for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
       type="horizontal_trail"
       title="Horizontal trail"
       view=".widgets.HorizontalTrail"
+      for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
       type="dropdown_list"
       title="Drop-down list"
       view=".widgets.DropDownList"
+      for="cpsskins.standard.ds.items.IItems"
   />
 
 
@@ -131,6 +139,7 @@
       type="image"
       title="Image"
       view=".widgets.Image"
+      for="cpsskins.standard.ds.image.IImage"
   />
 
 </configure>

Modified: cpsskins/branches/jmo-perspectives/standard/formats/effect.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/formats/effect.py       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/formats/effect.py       Tue Apr 
11 20:08:35 2006
@@ -21,7 +21,7 @@
 from zope.component.factory import Factory
 from zope.interface import implements, implementedBy
 from zope.i18nmessageid import MessageFactory
-from zope.schema import Choice, Int, Bool
+from zope.schema import Choice, List, Int, Bool
 
 from cpsskins.elements.format import Format
 from cpsskins.elements.interfaces import IFormat
@@ -34,10 +34,11 @@
 class IEffect(IFormat):
     """An effect"""
 
-    type = Choice(
+    types = List(
         title=_(u"Effect"),
         description=_(u"The type of effect to apply."),
-        vocabulary="effects by type")
+        #vocabulary="effects bytype")
+        )
 
     format = Choice(
         title=_(u"Image format"),
@@ -77,7 +78,7 @@
         self.keep_ratio = keep_ratio
 
     def __repr__(self):
-        return "<Effect of type: %s>" % self.type
+        return "<Effect of type: %s>" % ', '.join(self.types)
 
 EffectFactory = Factory(Effect, "Effect Factory",
                         "A Factory that creates Effects")

Modified: cpsskins/branches/jmo-perspectives/standard/formats/layout.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/formats/layout.py       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/formats/layout.py       Tue Apr 
11 20:08:35 2006
@@ -42,7 +42,7 @@
 class Layout(Format, Persistent):
     """A layout is used to format layout elements (cells, blocks, etc)
 
-    >>> layout = Layout(type=u'container')
+    >>> layout = Layout(types=[u'container'])
     >>> layout
     <Layout of type: container>
 
@@ -61,7 +61,7 @@
         self.data = OOBTree()
 
     def __repr__(self):
-        return "<Layout of type: %s>" % self.type
+        return "<Layout of type: %s>" % ', '.join(self.types)
 
     def traverse(self, name, remaining):
         if name in self:

Modified: cpsskins/branches/jmo-perspectives/standard/formats/style.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/formats/style.py        
(original)
+++ cpsskins/branches/jmo-perspectives/standard/formats/style.py        Tue Apr 
11 20:08:35 2006
@@ -105,7 +105,7 @@
         self.data = OOBTree()
 
     def __repr__(self):
-        return "<Style of type: %s>" % self.type
+        return "<Style of type: %s>" % ', '.join(self.types)
 
     def _wrap(self, k):
         if k == u'':

Modified: cpsskins/branches/jmo-perspectives/standard/formats/widget.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/formats/widget.py       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/formats/widget.py       Tue Apr 
11 20:08:35 2006
@@ -24,7 +24,7 @@
 from zope.interface import implements, implementedBy, alsoProvides
 from zope.i18nmessageid import MessageFactory
 from zope.schema.vocabulary import SimpleVocabulary
-from zope.schema import Choice
+from zope.schema import List
 
 from cpsskins import configuration
 from cpsskins.elements.format import Format
@@ -38,10 +38,9 @@
 class IWidget(IFormat):
     """A presentation widget"""
 
-    type = Choice(
-        title=_(u"Widget"),
-        description=_(u"The type of widget."),
-        vocabulary="Widgets",
+    types = List(
+        title=_(u"Widget types"),
+        description=_(u"The list of available widgets."),
         )
 
 IWidget.setTaggedValue('name', u'widget')
@@ -49,17 +48,17 @@
 class Widget(Persistent, Format):
     """A presentation element is used to present data with help of widgets.
 
-    >>> widget = Widget('plain')
+    >>> widget = Widget([u'vertical_menu'])
     >>> widget
-    Widget('plain')
+    <Widget: vertical_menu>
     """
     implements(IWidget)
 
-    def __init__(self, type=u''):
-        self.type = type
+    def __init__(self, types=[]):
+        self.types = types
 
     def __repr__(self):
-        return "Widget('%s')" % self.type
+        return "<Widget: %s>" % ', '.join(self.types)
 
 WidgetFactory = Factory(Widget, "Widget Factory",
                         "A Factory that creates Widgets")

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/actions/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/portlets/actions/configure.zcml 
(original)
+++ cpsskins/branches/jmo-perspectives/standard/portlets/actions/configure.zcml 
Tue Apr 11 20:08:35 2006
@@ -25,7 +25,7 @@
 
     <format
         name="widget"
-        type="vertical_menu"
+        types="vertical_menu"
     />
 
     <format

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/breadcrumbs/configure.zcml
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/standard/portlets/breadcrumbs/configure.zcml 
    (original)
+++ 
cpsskins/branches/jmo-perspectives/standard/portlets/breadcrumbs/configure.zcml 
    Tue Apr 11 20:08:35 2006
@@ -27,7 +27,7 @@
 
     <format
         name="widget"
-        type="horizontal_trail"
+        types="horizontal_trail"
     />
 
     <format

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/custom/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/portlets/custom/configure.zcml  
(original)
+++ cpsskins/branches/jmo-perspectives/standard/portlets/custom/configure.zcml  
Tue Apr 11 20:08:35 2006
@@ -28,7 +28,7 @@
 
     <format
         name="widget"
-        type="plain_html"
+        types="plain_html"
     />
 
     <format

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/dummy/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/portlets/dummy/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/standard/portlets/dummy/configure.zcml   
Tue Apr 11 20:08:35 2006
@@ -27,7 +27,7 @@
 
     <format
         name="widget"
-        type="plain_html"
+        types="plain_html"
     />
 
     <format

Modified: cpsskins/branches/jmo-perspectives/standard/portlets/dummy/portlet.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/portlets/dummy/portlet.py       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/portlets/dummy/portlet.py       
Tue Apr 11 20:08:35 2006
@@ -43,5 +43,5 @@
         self.text = text
 
     def __call__(self, info, **kw):
-        return unicode(self.text) or _(u"No text available")
+        return self.text or _(u"No text available")
 

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/image/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/portlets/image/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/standard/portlets/image/configure.zcml   
Tue Apr 11 20:08:35 2006
@@ -27,7 +27,7 @@
 
     <format
         name="widget"
-        type="image"
+        types="image"
     />
 
     <format
@@ -36,7 +36,7 @@
 
     <format
         name="effect"
-        type="scale"
+        types="scale"
     />
 
   </presentation>

Modified: 
cpsskins/branches/jmo-perspectives/standard/portlets/macroslot/configure.zcml
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/standard/portlets/macroslot/configure.zcml   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/standard/portlets/macroslot/configure.zcml   
    Tue Apr 11 20:08:35 2006
@@ -28,7 +28,7 @@
 
     <format
         name="widget"
-        type="plain_html"
+        types="plain_html"
     />
 
     <format
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to