[Zope-Checkins]
SVN: Zope/branches/five-integration/lib/python/Products/Five/
Merged r9837:9838, r9840:9844, r10062:10063,
and r10074:10075 from the Five trunk.
Stefan H. Holek
stefan at epy.co.at
Thu Mar 24 03:13:36 EST 2005
Log message for revision 29661:
Merged r9837:9838, r9840:9844, r10062:10063, and r10074:10075 from the Five trunk.
Changed:
U Zope/branches/five-integration/lib/python/Products/Five/CHANGES.txt
U Zope/branches/five-integration/lib/python/Products/Five/add.pt
U Zope/branches/five-integration/lib/python/Products/Five/browser.py
U Zope/branches/five-integration/lib/python/Products/Five/browserconfigure.py
U Zope/branches/five-integration/lib/python/Products/Five/configure.zcml
U Zope/branches/five-integration/lib/python/Products/Five/edit.pt
U Zope/branches/five-integration/lib/python/Products/Five/five_template.pt
U Zope/branches/five-integration/lib/python/Products/Five/meta.zcml
U Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/configure.zcml
A Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/meta.zcml
A Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py
U Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/testing.zcml
-=-
Modified: Zope/branches/five-integration/lib/python/Products/Five/CHANGES.txt
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/CHANGES.txt 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/CHANGES.txt 2005-03-24 08:13:36 UTC (rev 29661)
@@ -1,6 +1,13 @@
Five Changes
============
+* There is now a standard standard_macros. Five page templates can use
+ context/@@standard_macros/view to get the default site layout.
+* The addform and editform directive now supports the widget zcml subdirective,
+ that previously was ignored.
+
+* Five now supports the vocabulary zcml directive.
+
Five 0.3 (2005-03-11)
---------------------
Modified: Zope/branches/five-integration/lib/python/Products/Five/add.pt
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/add.pt 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/add.pt 2005-03-24 08:13:36 UTC (rev 29661)
@@ -1,6 +1,6 @@
-<html metal:use-macro="here/five_template/macros/master">
+<html metal:use-macro="context/@@standard_macros/page">
<body>
- <div metal:fill-slot="main">
+ <div metal:fill-slot="body">
<div metal:define-macro="addform">
Modified: Zope/branches/five-integration/lib/python/Products/Five/browser.py
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/browser.py 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/browser.py 2005-03-24 08:13:36 UTC (rev 29661)
@@ -143,7 +143,9 @@
raise KeyError, key
class StandardMacros(BrowserView, Macros):
- pass
+ macro_pages = ('five_template',
+ 'widget_macros',
+ 'form_macros',)
class EditView(BrowserView):
"""Simple edit-view base class
Modified: Zope/branches/five-integration/lib/python/Products/Five/browserconfigure.py
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/browserconfigure.py 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/browserconfigure.py 2005-03-24 08:13:36 UTC (rev 29661)
@@ -42,6 +42,7 @@
initializeClass
from pagetemplatefile import ZopeTwoPageTemplateFile
+import ExtensionClass
def page(_context, name, permission, for_,
layer='default', template=None, class_=None,
@@ -444,14 +445,19 @@
class_.generated_form = ZopeTwoPageTemplateFile(default_template)
- # Not the prettiest solution, but it works...
- class_.__init__ = EditView.__init__
s.provideView(for_, name, IBrowserRequest, class_, layer)
-class EditFormDirective(BaseFormDirective):
+class FiveFormDirective(BaseFormDirective):
+ def _processWidgets(self):
+ if self._widgets:
+ customWidgetsObject = makeClass('CustomWidgetsMixin', (ExtensionClass.Base,), self._widgets)
+ self.bases = self.bases + (customWidgetsObject,)
+
+class EditFormDirective(FiveFormDirective):
+
view = EditView
default_template = 'edit.pt'
title = 'Edit'
@@ -494,7 +500,7 @@
s.provideView(for_, name, IBrowserRequest, class_, layer)
-class AddFormDirective(BaseFormDirective):
+class AddFormDirective(FiveFormDirective):
view = AddView
default_template = 'add.pt'
Modified: Zope/branches/five-integration/lib/python/Products/Five/configure.zcml
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/configure.zcml 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/configure.zcml 2005-03-24 08:13:36 UTC (rev 29661)
@@ -44,6 +44,14 @@
permission="zope.Public"
/>
+ <browser:page
+ for="*"
+ name="standard_macros"
+ permission="zope2.View"
+ class=".browser.StandardMacros"
+ allowed_interface="zope.interface.common.mapping.IItemMapping"
+ />
+
<view
for="*"
factory=".browser.AbsoluteURL"
Modified: Zope/branches/five-integration/lib/python/Products/Five/edit.pt
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/edit.pt 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/edit.pt 2005-03-24 08:13:36 UTC (rev 29661)
@@ -1,7 +1,6 @@
<tal:tag condition="view/update"/>
-<html metal:use-macro="here/five_template/macros/master">
-<body metal:fill-slot="main">
- <div>
+<html metal:use-macro="context/@@standard_macros/page">
+<body metal:fill-slot="body">
<div metal:define-macro="body">
@@ -61,8 +60,6 @@
</form>
</div>
-
- </div>
</body>
</html>
Modified: Zope/branches/five-integration/lib/python/Products/Five/five_template.pt
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/five_template.pt 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/five_template.pt 2005-03-24 08:13:36 UTC (rev 29661)
@@ -1,10 +1,10 @@
-<html metal:define-macro="master">
+<html metal:define-macro="page">
<head>
<metal:block define-slot="css_slot">
</metal:block>
</head>
<body>
-<metal:block define-slot="main">
+<metal:block define-slot="body">
</metal:block>
</body>
</html>
Modified: Zope/branches/five-integration/lib/python/Products/Five/meta.zcml
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/meta.zcml 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/meta.zcml 2005-03-24 08:13:36 UTC (rev 29661)
@@ -81,6 +81,12 @@
</meta:complexDirective>
+ <meta:directive
+ name="vocabulary"
+ schema="zope.app.schema.metadirectives.IVocabularyDirective"
+ handler="zope.app.schema.metaconfigure.vocabulary"
+ />
+
</meta:directives>
<meta:directives namespace="http://namespaces.zope.org/browser">
Modified: Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/configure.zcml
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/configure.zcml 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/configure.zcml 2005-03-24 08:13:36 UTC (rev 29661)
@@ -309,7 +309,22 @@
name="edit.html"
permission="zope2.Public"
/>
-
+
+ <!-- With a widget override -->
+ <browser:editform
+ schema=".interfaces.IFieldSimpleContent"
+ for=".interfaces.IFieldSimpleContent"
+ name="widgetoverride.html"
+ permission="zope2.Public"
+ >
+
+ <widget
+ field="description"
+ class="zope.app.form.browser.TextAreaWidget"
+ />
+
+ </browser:editform>
+
<five:traversable class=".helpers.FiveTraversableFolder" />
<browser:addform
@@ -318,7 +333,21 @@
name="addsimplecontent.html"
permission="zope2.Public"
/>
+
+ <browser:addform
+ schema=".interfaces.IFieldSimpleContent"
+ content_factory=".simplecontent.FieldSimpleContent"
+ name="addwidgetoverride.html"
+ permission="zope2.Public">
+ <widget
+ field="description"
+ class="zope.app.form.browser.TextAreaWidget"
+ />
+
+ </browser:addform>
+
+
<!-- stuff that we'll override in overrides.zcml -->
<browser:page
@@ -430,9 +459,20 @@
for="zope.app.container.interfaces.IObjectRemovedEvent"
/>
+ <!-- Testing the vocabulary directive -->
+ <vocabulary
+ name="aVocabulary"
+ factory="zope.schema.tests.test_vocabulary.SampleVocabulary"
+ />
+
+ <!-- testing that products meta.zcml statements are picked up. -->
+ <five:parrot
+ class=".metaconfigure.NorwegianBlue"
+ name="Polly"
+ />
+
<!-- as new style classes are ignored, zope.app.form.browser
can be imported -->
-
<include package="zope.app.form.browser"/>
</configure>
Added: Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/meta.zcml
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/meta.zcml 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/meta.zcml 2005-03-24 08:13:36 UTC (rev 29661)
@@ -0,0 +1,15 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
+
+ <meta:directives namespace="http://namespaces.zope.org/five">
+
+ <meta:directive
+ name="parrot"
+ schema=".metaconfigure.IParrotDirective"
+ handler=".metaconfigure.parrot"
+ />
+
+ </meta:directives>
+
+</configure>
Added: Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py 2005-03-24 08:13:36 UTC (rev 29661)
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Parrot directive and support classes
+
+$Id: metaconfigure.py 5287 2004-06-25 11:42:27Z philikon $
+"""
+
+from zope.interface import Interface
+from zope.configuration.fields import GlobalObject
+from zope.schema import TextLine
+
+class IParrotDirective(Interface):
+ """State that a class implements something.
+ """
+ class_ = GlobalObject(
+ title=u"Class",
+ required=True
+ )
+
+ name = TextLine(
+ title=u"Name",
+ description=u"The parrots name.",
+ required=True
+ )
+
+def parrot(_context, class_, name):
+ parrot = class_()
+ parrot.pineForFjords()
+
+
+class NorwegianBlue(object):
+
+ def pineForFjords(self):
+ return "This parrot is no more!"
+
Property changes on: Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/metaconfigure.py
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/testing.zcml
===================================================================
--- Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/testing.zcml 2005-03-24 08:04:13 UTC (rev 29660)
+++ Zope/branches/five-integration/lib/python/Products/Five/tests/products/FiveTest/testing.zcml 2005-03-24 08:13:36 UTC (rev 29661)
@@ -3,6 +3,7 @@
<redefinePermission from="zope2.Public" to="zope.Public" />
+ <include file="meta.zcml" />
<include file="configure.zcml" />
<includeOverrides file="overrides.zcml" />
More information about the Zope-Checkins
mailing list