[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/Five/browser/ Fix Collector #2264: browser:view should set __name__

Martijn Pieters mj at zopatista.com
Tue Mar 27 10:57:28 EDT 2007


Log message for revision 73766:
  Fix Collector #2264: browser:view should set __name__

Changed:
  U   Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py
  U   Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt
  U   Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml

-=-
Modified: Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py	2007-03-27 14:57:27 UTC (rev 73765)
+++ Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py	2007-03-27 14:57:27 UTC (rev 73766)
@@ -251,6 +251,7 @@
         except:
             cname = "GeneratedClass"
             
+        cdict['__name__'] = name
         newclass = makeClass(cname, bases, cdict)
         
         _handle_for(_context, for_)

Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt	2007-03-27 14:57:27 UTC (rev 73765)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt	2007-03-27 14:57:27 UTC (rev 73766)
@@ -85,8 +85,18 @@
 
   >>> self.folder.unrestrictedTraverse('testoid/@@new_style_class2')
   <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
 -----------------------
 

Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml	2007-03-27 14:57:27 UTC (rev 73765)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml	2007-03-27 14:57:27 UTC (rev 73766)
@@ -218,6 +218,14 @@
       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 -->
 
   <!-- protected edit form for permission check -->



More information about the Zope-Checkins mailing list