[Zope-Checkins] SVN: Products.Five/branches/1.5/viewlet/manager.py Forward-ported viewlet manager directive fix (see c69896).
Malthe Borch
mborch at gmail.com
Thu Nov 20 19:20:56 EST 2008
Log message for revision 93212:
Forward-ported viewlet manager directive fix (see c69896).
Changed:
U Products.Five/branches/1.5/viewlet/manager.py
-=-
Modified: Products.Five/branches/1.5/viewlet/manager.py
===================================================================
--- Products.Five/branches/1.5/viewlet/manager.py 2008-11-21 00:20:26 UTC (rev 93211)
+++ Products.Five/branches/1.5/viewlet/manager.py 2008-11-21 00:20:56 UTC (rev 93212)
@@ -12,6 +12,8 @@
class ViewletManagerBase(origManagerBase, Acquisition.Explicit):
"""A base class for Viewlet managers to work in Zope2"""
+ template = None
+
def __getitem__(self, name):
"""See zope.interface.common.mapping.IReadMapping"""
# Find the viewlet
@@ -64,9 +66,10 @@
return sorted(viewlets, lambda x, y: cmp(aq_base(x[1]), aq_base(y[1])))
def ViewletManager(name, interface, template=None, bases=()):
-
+ attrDict = {'__name__': name}
+
if template is not None:
- template = ZopeTwoPageTemplateFile(template)
+ attrDict['template'] = ZopeTwoPageTemplateFile(template)
if ViewletManagerBase not in bases:
# Make sure that we do not get a default viewlet manager mixin, if the
@@ -76,8 +79,7 @@
bases = bases + (ViewletManagerBase,)
ViewletManager = type(
- '<ViewletManager providing %s>' % interface.getName(),
- bases,
- {'template': template, '__name__': name})
+ '<ViewletManager providing %s>' % interface.getName(), bases, attrDict)
+
zope.interface.classImplements(ViewletManager, interface)
return ViewletManager
More information about the Zope-Checkins
mailing list