Commit b15a39ec authored by Martijn Pieters's avatar Martijn Pieters

Fix Collector #2264: browser:view should set __name__

parent d60ce904
...@@ -251,6 +251,7 @@ class view(zope_app_view): ...@@ -251,6 +251,7 @@ class view(zope_app_view):
except: except:
cname = "GeneratedClass" cname = "GeneratedClass"
cdict['__name__'] = name
newclass = makeClass(cname, bases, cdict) newclass = makeClass(cname, bases, cdict)
_handle_for(_context, for_) _handle_for(_context, for_)
......
...@@ -85,7 +85,17 @@ sure it is now: ...@@ -85,7 +85,17 @@ sure it is now:
>>> self.folder.unrestrictedTraverse('testoid/@@new_style_class2') >>> self.folder.unrestrictedTraverse('testoid/@@new_style_class2')
<Products.Five.metaclass.NewStyleClass ...> <Products.Five.metaclass.NewStyleClass ...>
Both browser:view and browser:page are ILocation providers, so make sure they
have a __name__ attribute:
>>> page = self.folder.unrestrictedTraverse('testoid/eagle.txt')
>>> page.__name__
u'eagle.txt'
>>> view = self.folder.unrestrictedTraverse('testoid/named_view')
>>> view.__name__
u'named_view'
ZPT-based browser pages ZPT-based browser pages
----------------------- -----------------------
......
...@@ -218,6 +218,14 @@ ...@@ -218,6 +218,14 @@
permission="zope2.Public" permission="zope2.Public"
/> />
<!-- A named view -->
<browser:view
name="named_view"
for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
permission="zope2.Public"
/>
<!-- XXX this should really be in Five.form.tests --> <!-- XXX this should really be in Five.form.tests -->
<!-- protected edit form for permission check --> <!-- protected edit form for permission check -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment