[Zope-Checkins] SVN: Products.Five/trunk/ Fixed an issue where new-style classes could not be used for view components with <browser:page>.

Rocky Burt rocky at serverzen.com
Thu May 25 16:30:24 EDT 2006


Log message for revision 68288:
  Fixed an issue where new-style classes could not be used for view components with <browser:page>.

Changed:
  U   Products.Five/trunk/CHANGES.txt
  U   Products.Five/trunk/browser/metaconfigure.py
  U   Products.Five/trunk/browser/tests/pages.txt
  U   Products.Five/trunk/browser/tests/pages.zcml

-=-
Modified: Products.Five/trunk/CHANGES.txt
===================================================================
--- Products.Five/trunk/CHANGES.txt	2006-05-25 20:25:06 UTC (rev 68287)
+++ Products.Five/trunk/CHANGES.txt	2006-05-25 20:30:23 UTC (rev 68288)
@@ -8,6 +8,9 @@
 Bugfixes
 --------
 
+* Fixed an issue where new-style classes could not be used for
+  view components with <browser:page>.
+
 * Provided the 'default' layer alias for backwards compability.  It
   was deleted by accident during the Zope 3.3 port.
 

Modified: Products.Five/trunk/browser/metaconfigure.py
===================================================================
--- Products.Five/trunk/browser/metaconfigure.py	2006-05-25 20:25:06 UTC (rev 68287)
+++ Products.Five/trunk/browser/metaconfigure.py	2006-05-25 20:30:23 UTC (rev 68288)
@@ -75,10 +75,6 @@
             raise ConfigurationError("No such file", template)
 
     if class_:
-        # new-style classes do not work with Five. As we want to import
-        # packages from z3 directly, we ignore new-style classes for now.
-        if type(class_) == type:
-            return
         if attribute != '__call__':
             if not hasattr(class_, attribute):
                 raise ConfigurationError(

Modified: Products.Five/trunk/browser/tests/pages.txt
===================================================================
--- Products.Five/trunk/browser/tests/pages.txt	2006-05-25 20:25:06 UTC (rev 68287)
+++ Products.Five/trunk/browser/tests/pages.txt	2006-05-25 20:30:23 UTC (rev 68288)
@@ -74,16 +74,11 @@
   >>> view.eagle.__doc__ == SimpleView.eagle.__doc__
   True
 
-Test whether new-style classes are ignored when registering browser
-pages with view classes.  When traversing for a non-existing view, we
-should get an AttributeError:
+Make sure new-style classes work fine as view classes:
 
   >>> self.folder.unrestrictedTraverse('testoid/@@new_style_class')
-  Traceback (most recent call last):
-  ...
-  AttributeError: @@new_style_class
+  <Products.Five.metaclass.NewStyleClass ...>
 
-
 ZPT-based browser pages
 -----------------------
 

Modified: Products.Five/trunk/browser/tests/pages.zcml
===================================================================
--- Products.Five/trunk/browser/tests/pages.zcml	2006-05-25 20:25:06 UTC (rev 68287)
+++ Products.Five/trunk/browser/tests/pages.zcml	2006-05-25 20:30:23 UTC (rev 68288)
@@ -190,7 +190,7 @@
       permission="zope2.Public"
       />
 
-  <!-- browser:page directives with new style classes are ignored -->
+  <!-- make sure browser:page directives with new style classes work -->
 
   <browser:page
       for="Products.Five.tests.testing.simplecontent.ISimpleContent"



More information about the Zope-Checkins mailing list