[Zope3-checkins] SVN: Zope3/trunk/src/zope/viewlet/manager.py Bug Fix: If the template is defined in Python code and not provided via

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 30 17:51:26 EDT 2006


Log message for revision 69896:
  Bug Fix: If the template is defined in Python code and not provided via 
           the directive, then do not override the template with None.
  

Changed:
  U   Zope3/trunk/src/zope/viewlet/manager.py

-=-
Modified: Zope3/trunk/src/zope/viewlet/manager.py
===================================================================
--- Zope3/trunk/src/zope/viewlet/manager.py	2006-08-30 17:37:40 UTC (rev 69895)
+++ Zope3/trunk/src/zope/viewlet/manager.py	2006-08-30 21:51:25 UTC (rev 69896)
@@ -30,6 +30,7 @@
     A generic manager class which can be instantiated
     """
     zope.interface.implements(interfaces.IViewletManager)
+    template = None
 
     def __init__(self, context, request, view):
         self.__updated = False
@@ -114,8 +115,9 @@
 
 def ViewletManager(name, interface, template=None, bases=()):
 
+    attrDict = {'__name__' : name}
     if template is not None:
-        template = ViewPageTemplateFile(template)
+        attrDict['template'] = ViewPageTemplateFile(template)
 
     if ViewletManagerBase not in bases:
         # Make sure that we do not get a default viewlet manager mixin, if the
@@ -125,8 +127,6 @@
             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 Zope3-Checkins mailing list