[Zope-Checkins] SVN: Products.Five/branches/1.4/ - 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:01:15 EDT 2006
Log message for revision 68290:
- 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.4/CHANGES.txt
U Products.Five/branches/1.4/browser/metaconfigure.py
U Products.Five/branches/1.4/browser/tests/pages.txt
U Products.Five/branches/1.4/browser/tests/pages.zcml
-=-
Modified: Products.Five/branches/1.4/CHANGES.txt
===================================================================
--- Products.Five/branches/1.4/CHANGES.txt 2006-05-25 20:44:07 UTC (rev 68289)
+++ Products.Five/branches/1.4/CHANGES.txt 2006-05-25 21:01:15 UTC (rev 68290)
@@ -8,6 +8,12 @@
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.testbrowser does not swallow cookies anymore, based on patch by
Daniel Nouri.
Modified: Products.Five/branches/1.4/browser/metaconfigure.py
===================================================================
--- Products.Five/branches/1.4/browser/metaconfigure.py 2006-05-25 20:44:07 UTC (rev 68289)
+++ Products.Five/branches/1.4/browser/metaconfigure.py 2006-05-25 21:01:15 UTC (rev 68290)
@@ -73,10 +73,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(
@@ -113,7 +109,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.4/browser/tests/pages.txt
===================================================================
--- Products.Five/branches/1.4/browser/tests/pages.txt 2006-05-25 20:44:07 UTC (rev 68289)
+++ Products.Five/branches/1.4/browser/tests/pages.txt 2006-05-25 21:01:15 UTC (rev 68290)
@@ -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.4/browser/tests/pages.zcml
===================================================================
--- Products.Five/branches/1.4/browser/tests/pages.zcml 2006-05-25 20:44:07 UTC (rev 68289)
+++ Products.Five/branches/1.4/browser/tests/pages.zcml 2006-05-25 21:01:15 UTC (rev 68290)
@@ -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"
@@ -200,6 +200,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