Author: jmorliaguet
Date: Mon Oct 24 11:37:36 2005
New Revision: 28558

Modified:
   z3lab/cpsskins/branches/jmo-perspectives/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/cell_edit_layout.pt
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/portlet_edit.pt
   z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/layout.py
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/portlet_edit.pt
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/slot_edit.pt
   
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/pageblock_edit_layout.pt
   z3lab/cpsskins/branches/jmo-perspectives/browser/rendering/engine.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/renderers/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/interfaces.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/slot.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py
   z3lab/cpsskins/branches/jmo-perspectives/portlets/actions/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/portlets/custom/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/portlets/macroslot/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/thememanager.py
Log:

- a bit of refactoring on the rendering engine:

  - global variables are stored as request annotations

  - the tree is built before being rendered and the structure is stored in the
    request




Modified: z3lab/cpsskins/branches/jmo-perspectives/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/__init__.py        (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/__init__.py        Mon Oct 24 
11:37:36 2005
@@ -18,3 +18,5 @@
 __docformat__ = "reStructuredText"
 
 from cpsskins.elements.portlet import Portlet
+
+from cpsskins.thememanager import getThemeManager, getContexts

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/cell_edit_layout.pt
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/cell_edit_layout.pt
      (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/cell_edit_layout.pt
      Mon Oct 24 11:37:36 2005
@@ -1,10 +1,9 @@
 <td class="editable" style="vertical-align:top"
   tal:define="
     info options/info;
-    perspective info/perspective;
+    perspective options/perspective;
     rendered options/rendered;
     display info/display;
-    actual_display info/actual_display;
     formats display/formattable:getFormatNames;
     canvas_mode options/canvas_mode|nothing;
     mode_is_layout python:canvas_mode == 'layout';

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/__init__.py
      (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/__init__.py
      Mon Oct 24 11:37:36 2005
@@ -22,6 +22,7 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 
+from cpsskins import getContexts
 from cpsskins.browser.rendering.interfaces import IFilter
 from cpsskins.elements.interfaces import IDisplay
 
@@ -33,9 +34,14 @@
     adapts(IDisplay, IRequest)
     implements(IFilter)
 
-    def __call__(self, data='', info=None, **kw):
+    def __call__(self, rendered='', info=None, **kw):
         """Apply the editor.
         """
-        editor = getMultiAdapter((info.element, self.request),
+        request = self.request
+        contexts = getContexts(request)
+        perspective = contexts['perspective']
+
+        editor = getMultiAdapter((info.element, request),
             name='editor (content authoring)')
-        return editor(rendered=data, info=info, **kw)
+        return editor(rendered=rendered, perspective=perspective, info=info,
+                      **kw)

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/portlet_edit.pt
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/portlet_edit.pt
  (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/content/portlet_edit.pt
  Mon Oct 24 11:37:36 2005
@@ -2,10 +2,11 @@
   tal:define="
     parent view/getParent;
     info options/info;
-    perspective info/perspective;
+    perspective options/perspective;
     display info/display;
-    actual_display info/actual_display;
-    formats action_display/formattable:getFormatNames|python:[];
+    getDisplay nocall:context/displayable:getDisplay;
+    actual_display python: getDisplay(perspective);
+    formats actual_display/formattable:getFormatNames|python:[];
     parent_type parent/elementtype;
     editable python: str(parent_type) == 'ISlot' and 1 or 0;
     title context/title;

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/layout.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/layout.py    
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/layout.py    
    Mon Oct 24 11:37:36 2005
@@ -21,6 +21,7 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 
+from cpsskins import getContexts
 from cpsskins.elements.formats.interfaces import IFormat
 from cpsskins.browser.rendering.interfaces import IFilter
 
@@ -34,12 +35,18 @@
         self.context = context
         self.request = request
 
-    def __call__(self, data='', info=None, **kw):
+    def __call__(self, rendered='', info=None, **kw):
         """Apply the layout editor.
         """
         layout = self.context
-        element = info.element
         request = self.request
+
+        element = info.element
+
+        contexts = getContexts(request)
+        perspective = contexts['perspective']
+
         editor = getMultiAdapter((element, request), name='editor (layout)')
-        rendered=editor(rendered=data, layout=layout, info=info, **kw)
+        rendered=editor(rendered=rendered, layout=layout, info=info,
+                        perspective=perspective, **kw)
         return rendered

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/__init__.py
 (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/__init__.py
 Mon Oct 24 11:37:36 2005
@@ -22,6 +22,7 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 
+from cpsskins import getContexts
 from cpsskins.browser.rendering.interfaces import IFilter
 from cpsskins.elements.interfaces import IDisplay
 
@@ -33,9 +34,14 @@
     adapts(IDisplay, IRequest)
     implements(IFilter)
 
-    def __call__(self, data='', info=None, **kw):
+    def __call__(self, rendered='', info=None, **kw):
         """Apply the editor to the element.
         """
-        editor = getMultiAdapter((info.element, self.request),
+        request = self.request
+        contexts = getContexts(request)
+        perspective = contexts['perspective']
+
+        editor = getMultiAdapter((info.element, request),
             name='editor (page authoring)')
-        return editor(rendered=data, info=info, **kw)
+        return editor(rendered=rendered, perspective=perspective, info=info,
+                      **kw)

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/portlet_edit.pt
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/portlet_edit.pt
     (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/portlet_edit.pt
     Mon Oct 24 11:37:36 2005
@@ -2,8 +2,7 @@
   tal:define="
     info options/info;
     display info/display;
-    perspective info/perspective;
-    actual_display info/actual_display;
+    perspective options/perspective;
     canvas_mode options/canvas_mode|nothing;
     mode_is_layout python:canvas_mode == 'layout';
     formats display/formattable:getFormatNames;

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/slot_edit.pt
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/slot_edit.pt
        (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/page/slot_edit.pt
        Mon Oct 24 11:37:36 2005
@@ -1,8 +1,7 @@
 <tal:block define="
   info options/info;
-  perspective info/perspective;
+  perspective options/perspective;
   rendered options/rendered;
-  actual_display info/actual_display;
   display info/display;
   formats display/formattable:getFormatNames;
   slot_title context/title;

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/pageblock_edit_layout.pt
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/pageblock_edit_layout.pt
 (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/filters/pageblock_edit_layout.pt
 Mon Oct 24 11:37:36 2005
@@ -2,8 +2,7 @@
   define="
     canvas_mode options/canvas_mode|nothing;
     info options/info;
-    perspective info/perspective;
-    actual_display info/actual_display;
+    perspective options/perspective;
     display info/display;
     formats display/formattable:getFormatNames;
     mode_is_layout python:canvas_mode == 'layout';

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        
Mon Oct 24 11:37:36 2005
@@ -25,13 +25,13 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 
+from cpsskins import getThemeManager, getContexts
 from cpsskins.browser.negociation.interfaces import INegociation
 from cpsskins.browser.rendering.interfaces import IDisplayData, IUpdateData
 from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.elements.interfaces import IElement, ILeaf, ISlot, IDisplayable
 from cpsskins.relations.interfaces import IPredicate
 from cpsskins.storage.interfaces import IRelationStorage
-from cpsskins.thememanager import getThemeManager
 from interfaces import IViewer, IRenderer, IFilter, IContextInfo
 
 import logging
@@ -128,74 +128,88 @@
         self.element = element
         self.request = request
 
+        contexts = getContexts(request)
+
         theme = getThemeManager().getThemeInContext(element)
         relations = theme.getStorage(IRelationStorage)
         perspective = getMultiAdapter((element, request),
                                        INegociation).getPerspective()
 
-        self.info = ContextInfo({
-            'request': self.request,
-            'relations': relations,
-            'perspective': perspective,
-            })
+        contexts['theme'] = theme
+        contexts['relations'] = relations
+        contexts['perspective'] = perspective
+
+        # build the tree and store it in the request
+        contexts['tree'] = _buildTreeInfo(node=element, 
perspective=perspective)
 
     def __call__(self, **kw):
         element = self.element
-        info = self.info
+        request = self.request
 
         # update global context info variables pass as keyword parameters
-        info.update({
-            'view': kw.get('view'),
-            'location': kw.get('location'),
-            'template': kw.get('template'),
-            'engine': kw.get('engine', 'default'),
-            })
+        contexts = getContexts(request)
+        contexts['view'] = kw.get('view')
+        contexts['location'] = kw.get('location')
+        contexts['template'] = kw.get('template')
+        contexts['engine'] = kw.get('engine', 'default')
 
-        # TODO create the tree
-
-        # TODO update the tree
+        # TODO update the tree nodes
 
         # render the tree
-        return getMultiAdapter((element, info), IRenderer)(**kw)
+        return getMultiAdapter((element, request), IRenderer)(**kw)
+
+def _buildTreeInfo(index={}, node=None, perspective=None):
+    """Build the tree info for an element.
+    """
+    node_index = index[node.identifier] = {}
+
+    # if the object is inside a slot, get the parent's display.
+    display = IDisplayable(node).getEffectiveDisplay(perspective)
+    if display is None:
+        parent = getParent(node)
+        if ISlot.providedBy(parent):
+            display = IDisplayable(parent).getEffectiveDisplay(perspective)
+
+    children = node.getChildNodes(display=display, perspective=perspective)
+
+    node_index['display'] = display
+    node_index['children'] = children
+
+    for child in children:
+        _buildTreeInfo(index=index, node=child, perspective=perspective)
+
+    return index
 
 class Renderer(object):
     """A renderer is a collection of filters. It provides some rendering
     for elements.
     """
-    adapts(IElement, IContextInfo)
+    adapts(IElement, IRequest)
     implements(IRenderer)
 
-    def __init__(self, element, info):
+    def __init__(self, element, request):
         self.element = element
-        # create a copy of the global context info structure
-        self.info = ContextInfo(info)
+        self.request = request
 
-        perspective = info.perspective
+    def __call__(self, **kw):
+        """Do the actual rendering by applying all filters.
+        """
+        element = self.element
+        request = self.request
 
-        displayable = IDisplayable(element)
-        display = displayable.getEffectiveDisplay(perspective)
-        actual_display = displayable.getDisplay(perspective)
-
-        # if the object is inside a slot, get the parent's display.
-        parent = getParent(element)
-        if display is None and ISlot.providedBy(parent):
-            display = IDisplayable(parent).getEffectiveDisplay(perspective)
+        contexts = getContexts(request)
+        element_info = contexts['tree'][element.identifier]
+        engine = contexts['engine']
 
         # set local context info variables
-        self.info.update(
+        info = ContextInfo(
             {'element': element,
-             'display': display,
-             'actual_display': actual_display,
+             'display': element_info['display'],
+             'request': request,
              'data': None,
              'metadata': None,
             })
 
-    def __call__(self, **kw):
-        """Do the actual rendering by applying all filters.
-        """
-        info = self.info
-        element, request = info.element, info.request
-
         rendered = []
         if ILeaf.providedBy(element):
             # do the actual rendering
@@ -203,13 +217,11 @@
             if callable(display_data):
                 rendered.append(display_data(**kw))
         else:
-            for node in element.getChildNodes(info=info):
-                renderer = getMultiAdapter((node, info), IRenderer)
+            for node in element_info['children']:
+                renderer = getMultiAdapter((node, request), IRenderer)
                 rendered.append(renderer(**kw))
         rendered = ''.join(rendered)
 
-        engine = info.engine
-
         # look for renderers associated to the element's content type
         iface = element.getContentType()
         if (iface, engine) not in renderer_registry:
@@ -223,26 +235,24 @@
                 )
             return rendered
 
+        display = element_info['display']
         # apply all filters
-        for f in self._getFilters(iface):
+        for f in self._getFilters(iface, display, engine):
             rendered = f(rendered, info, **kw)
 
         # Filter output
         return rendered
 
-    def _getFilters(self, iface):
+    def _getFilters(self, iface, display, engine):
         """Get the list of filters
         """
-        info = self.info
-        element, request = info.element, info.request
-
-        display = info.display
+        element, request = self.element, self.request
 
         if display is None:
             return []
 
-        engine = info.engine
-        relations = info.relations
+        contexts = getContexts(request)
+        relations = contexts['relations']
 
         filters = []
         for filter_name in renderer_registry.get((iface, engine), []):

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
   Mon Oct 24 11:37:36 2005
@@ -23,7 +23,6 @@
 from zope.i18nmessageid import MessageFactory
 from zope.publisher.interfaces.browser import IBrowserRequest
 
-from cpsskins.interfaces import IContextInfo
 from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.browser.rendering.engine import Renderer as RenderingEngine
 from cpsskins.browser.rendering.interfaces import IRenderer
@@ -68,7 +67,7 @@
         adapter(_context=_context,
                 factory=(RenderingEngine,),
                 provides=IRenderer,
-                for_=(iface, IContextInfo),
+                for_=(iface, IBrowserRequest),
                )
         registered_adapters.append(iface)
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/__init__.py       
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/__init__.py       Mon Oct 
24 11:37:36 2005
@@ -86,7 +86,7 @@
         Node.__init__(self)
         OrderedContainer.__init__(self)
 
-    def getChildNodes(self, iface=None, info=None):
+    def getChildNodes(self, iface=None, display=None, perspective=None):
         """Return the list of child nodes implementing the specified interface
            Override this method if the element is a virtual container.
         """
@@ -106,7 +106,7 @@
     def __init__(self):
         Node.__init__(self)
 
-    def getChildNodes(self, iface=None, info=None):
+    def getChildNodes(self, iface=None, display=None, perspective=None):
         """Return the list of child nodes implementing the specified interface
         """
         return []

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     Mon Oct 
24 11:37:36 2005
@@ -58,19 +58,16 @@
         Elements are identified by their id.
         """
 
-class IInnerNode(INode, IOrderedContainer):
-
-    def getChildNodes(iface, info):
+    def getChildNodes(iface, display, perspective):
         """Return the list of child nodes implementing the specified interface
         Override this method if the element is a virtual container.
         """
 
-class ILeaf(INode):
+class IInnerNode(INode, IOrderedContainer):
+    """An inner node has children"""
 
-    def getChildNodes(iface, info):
-        """Return the list of child nodes implementing the specified interface
-        Override this method if the element is a virtual container.
-        """
+class ILeaf(INode):
+    """A leaf node has no children"""
 
 
 # The properties of elements

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/slot.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/slot.py   (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/slot.py   Mon Oct 24 
11:37:36 2005
@@ -52,18 +52,14 @@
     def __repr__(self):
         return "Slot('%s', '%s')" % (self.title, str(self))
 
-    def getChildNodes(self, iface=None, info=None):
+    def getChildNodes(self, iface=None, display=None, perspective=None):
         """Return the list of child nodes implementing the specified interface
            Override this method if the element is a virtual container.
         """
-        if info is None:
-            return []
         if iface and not iface is IPortlet:
             return []
 
         reltool = RelationTool(self)
-        display = info.display
-        perspective = info.perspective
 
         if perspective is None:
             portlets = reltool.getSeconds(

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py  (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/theme.py  Mon Oct 24 
11:37:36 2005
@@ -56,7 +56,7 @@
                 return page
         return None
 
-    def getChildNodes(self, iface=None, info=None):
+    def getChildNodes(self, iface=None, display=None, perspective=None):
         """Get the child elements in the rendering tree.
         We override InnerNode.getChildNodes() to return only the page that
         will be displayed.

Modified: z3lab/cpsskins/branches/jmo-perspectives/portlets/actions/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/portlets/actions/__init__.py       
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/portlets/actions/__init__.py       
Mon Oct 24 11:37:36 2005
@@ -25,7 +25,7 @@
 from zope.schema import TextLine
 from zope.i18nmessageid import MessageFactory
 
-from cpsskins import Portlet
+from cpsskins import Portlet, getContexts
 from cpsskins.interfaces import IPortlet, IContextInfo, IDisplayData
 from cpsskins.model import Items, Item
 
@@ -54,8 +54,10 @@
     implements(IDisplayData)
 
     def __init__(self, portlet, info):
+        request = info.request
+        contexts = getContexts(request)
         try:
-           menu = getMenu(portlet.category, info.location, info.request)
+           menu = getMenu(portlet.category, contexts['location'], request)
         except ComponentLookupError:
            items = []
         else:

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/__init__.py   
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/__init__.py   
Mon Oct 24 11:37:36 2005
@@ -46,7 +46,9 @@
     implements(IDisplayData)
 
     def __init__(self, portlet, info):
-        url = getMultiAdapter((info.location, info.request), IAbsoluteURL)
+        request = info.request
+        contexts = request.annotations['cpsskins.contexts']
+        url = getMultiAdapter((contexts['location'], request), IAbsoluteURL)
         items = [
             Item(title=bc['name'], url=bc['url'])
             for bc in url.breadcrumbs()

Modified: z3lab/cpsskins/branches/jmo-perspectives/portlets/custom/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/portlets/custom/__init__.py        
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/portlets/custom/__init__.py        
Mon Oct 24 11:37:36 2005
@@ -28,7 +28,7 @@
 from zope.schema import Choice, Text
 from zope.schema.vocabulary import SimpleVocabulary
 
-from cpsskins import Portlet
+from cpsskins import Portlet, getContexts
 from cpsskins.interfaces import IPortlet, IContextInfo, IDisplayData
 
 _ = MessageFactory("cpsskins")
@@ -82,12 +82,15 @@
         info = self.info
         portlet = self.portlet
 
+        request = info.request
+        contexts = getContexts(request)
+
         format = portlet.format
         if format in page_factories:
             page = page_factories[format]()
-            page = contained(page, info.location)
+            page = contained(page, contexts['location'])
             page.setSource(portlet.source)
-            markup = unicode(_renderPage(page, info.request))
+            markup = unicode(_renderPage(page, request))
         else:
             markup = _("Page not configured.")
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/portlets/macroslot/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/portlets/macroslot/__init__.py     
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/portlets/macroslot/__init__.py     
Mon Oct 24 11:37:36 2005
@@ -25,6 +25,7 @@
 from zope.publisher.interfaces.browser import ILayer, IDefaultBrowserLayer
 from zope.publisher.interfaces.browser import IBrowserRequest
 
+from cpsskins import getContexts
 from cpsskins.elements.portlet import Portlet
 from cpsskins.interfaces import IPortlet, IContextInfo, IDisplayData
 
@@ -61,13 +62,17 @@
         info = self.info
         portlet = self.portlet
 
-        view, template, request = info.view, info.template, info.request
+        request = info.request
+        contexts = getContexts(request)
+
+        view = contexts['view']
+        template = contexts['template']
 
         if view is not None:
             # Switch to the macroless skin before rendering the view
             applySkin(request, IMacrolessSkin)
             # Render the view
-            markup = info.template(instance=view)
+            markup = template(instance=view)
         else:
             macro_slot_editor = zapi.queryMultiAdapter(
                 (portlet, request), name='macroSlotEditor')

Modified: z3lab/cpsskins/branches/jmo-perspectives/thememanager.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/thememanager.py    (original)
+++ z3lab/cpsskins/branches/jmo-perspectives/thememanager.py    Mon Oct 24 
11:37:36 2005
@@ -201,3 +201,8 @@
 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