[Zope3-checkins] SVN: Zope3/trunk/src/zope/viewlet/m Make sure that
the viewlet manager and the viewlets always know their
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jan 3 16:38:40 EST 2006
Log message for revision 41120:
Make sure that the viewlet manager and the viewlets always know their
name. This is important for some traversal.
Changed:
U Zope3/trunk/src/zope/viewlet/manager.py
U Zope3/trunk/src/zope/viewlet/metaconfigure.py
-=-
Modified: Zope3/trunk/src/zope/viewlet/manager.py
===================================================================
--- Zope3/trunk/src/zope/viewlet/manager.py 2006-01-03 21:37:34 UTC (rev 41119)
+++ Zope3/trunk/src/zope/viewlet/manager.py 2006-01-03 21:38:40 UTC (rev 41120)
@@ -24,7 +24,6 @@
from zope.viewlet import interfaces
-
class ViewletManagerBase(object):
"""The Viewlet Manager Base
@@ -113,7 +112,7 @@
return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
-def ViewletManager(interface, template=None, bases=()):
+def ViewletManager(name, interface, template=None, bases=()):
if template is not None:
template = ViewPageTemplateFile(template)
@@ -128,6 +127,6 @@
ViewletManager = type(
'<ViewletManager providing %s>' % interface.getName(),
bases,
- {'template': template})
+ {'template': template, '__name__' : name})
zope.interface.classImplements(ViewletManager, interface)
return ViewletManager
Modified: Zope3/trunk/src/zope/viewlet/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/viewlet/metaconfigure.py 2006-01-03 21:37:34 UTC (rev 41119)
+++ Zope3/trunk/src/zope/viewlet/metaconfigure.py 2006-01-03 21:38:40 UTC (rev 41120)
@@ -58,10 +58,10 @@
# Create a new class based on the template and class.
new_class = manager.ViewletManager(
- provides, template=template, bases=(class_, ))
+ name, provides, template=template, bases=(class_, ))
else:
# Create a new class based on the class.
- new_class = manager.ViewletManager(provides, bases=(class_, ))
+ new_class = manager.ViewletManager(name, provides, bases=(class_, ))
# Register some generic attributes with the security dictionary
for attr_name in ('browserDefault', 'update', 'render', 'publishTraverse'):
@@ -142,7 +142,7 @@
if template:
# Create a new class for the viewlet template and class.
new_class = viewlet.SimpleViewletClass(
- template, bases=(class_, ), attributes=kwargs)
+ template, bases=(class_, ), attributes=kwargs, name=name)
else:
if not hasattr(class_, 'browserDefault'):
cdict = {'browserDefault':
More information about the Zope3-Checkins
mailing list