[Zope-Checkins] SVN: Products.Five/branches/1.2/ - Fixed an issue where <browser:page> based views that didn't have template or attribute defined weren't getting BrowserView mixed in.

Rocky Burt rocky at serverzen.com
Thu May 25 17:10:13 EDT 2006


Log message for revision 68292:
  - Fixed an issue where <browser:page> based views that didn't have template or attribute defined weren't getting BrowserView mixed in.
  - Fixed an issue where new-style classes could not be used for view components with <browser:page>.

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

-=-
Modified: Products.Five/branches/1.2/CHANGES.txt
===================================================================
--- Products.Five/branches/1.2/CHANGES.txt	2006-05-25 21:07:29 UTC (rev 68291)
+++ Products.Five/branches/1.2/CHANGES.txt	2006-05-25 21:10:12 UTC (rev 68292)
@@ -2,6 +2,18 @@
 Five Changes
 ============
 
+Five 1.2.x (unreleased)
+=======================
+
+Bugfixes
+--------
+
+* Fixed an issue where <browser:page> based views that didn't have
+  template or attribute defined weren't getting BrowserView mixed in.
+
+* Fixed an issue where new-style classes could not be used for
+  view components with <browser:page>.
+
 Five 1.2.4 (2006-05-04)
 =======================
 

Modified: Products.Five/branches/1.2/browser/metaconfigure.py
===================================================================
--- Products.Five/branches/1.2/browser/metaconfigure.py	2006-05-25 21:07:29 UTC (rev 68291)
+++ Products.Five/branches/1.2/browser/metaconfigure.py	2006-05-25 21:10:12 UTC (rev 68292)
@@ -77,10 +77,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(
@@ -116,7 +112,8 @@
             # some security declarations on it so we really shouldn't
             # modify the original.  So, instead we make a new class
             # with just one base class -- the original
-            new_class = makeClass(class_.__name__, (class_,), cdict)
+            new_class = makeClass(class_.__name__, 
+                                  (class_, BrowserView), cdict)
 
     else:
         # template

Modified: Products.Five/branches/1.2/browser/tests/pages.txt
===================================================================
--- Products.Five/branches/1.2/browser/tests/pages.txt	2006-05-25 21:07:29 UTC (rev 68291)
+++ Products.Five/branches/1.2/browser/tests/pages.txt	2006-05-25 21:10:12 UTC (rev 68292)
@@ -74,16 +74,19 @@
   >>> 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 ...>
+  
+At one point browser classes with no attribute and no template
+values specified wasn't getting BrowserView mixed in.  Lets make
+sure it is now:
 
+  >>> self.folder.unrestrictedTraverse('testoid/@@new_style_class2')
+  <Products.Five.metaclass.NewStyleClass ...>
 
+
 ZPT-based browser pages
 -----------------------
 

Modified: Products.Five/branches/1.2/browser/tests/pages.zcml
===================================================================
--- Products.Five/branches/1.2/browser/tests/pages.zcml	2006-05-25 21:07:29 UTC (rev 68291)
+++ Products.Five/branches/1.2/browser/tests/pages.zcml	2006-05-25 21:10:12 UTC (rev 68292)
@@ -183,7 +183,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"
@@ -193,6 +193,14 @@
       permission="zope2.Public"
       />
 
+  <browser:page
+      for="Products.Five.tests.testing.simplecontent.ISimpleContent"
+      class=".pages.NewStyleClass"
+      name="new_style_class2"
+      permission="zope2.Public"
+      />
+
+
   <!-- Verify that browser:view works, especially when no specific
        view attribute is specified -->
 



More information about the Zope-Checkins mailing list