[Zope3-checkins] CVS: Zope3/src/zope/app/browser/utilities -
configure.zcml:1.3 content.py:1.4
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Aug 18 15:56:04 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/utilities
In directory cvs.zope.org:/tmp/cvs-serv26491/browser/utilities
Modified Files:
configure.zcml content.py
Log Message:
Beefed up the Content Component Definition component, by supporting
flexible menu entries, which is very nice.
I consider my work on schema-driven Content Components done now and
encourage people to try it out. I think this functionality addresses an
audience that we have not dealt with much before, i.e. people that stand
somewhere between scripter and TTW developers.
=== Zope3/src/zope/app/browser/utilities/configure.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/utilities/configure.zcml:1.2 Fri Aug 15 20:43:11 2003
+++ Zope3/src/zope/app/browser/utilities/configure.zcml Mon Aug 18 14:55:29 2003
@@ -149,19 +149,30 @@
<editform
for="zope.app.interfaces.utilities.content.IContentComponentDefinition"
- schema="zope.app.interfaces.utilities.content.IContentComponentDefinition"
+ schema=
+ "zope.app.interfaces.utilities.content.IContentComponentDefinition"
name="edit.html"
- fields="schema"
+ fields="schema copySchema"
menu="zmi_views" title="Edit"
permission="zope.ManageContent"/>
<editform
for="zope.app.interfaces.utilities.content.IContentComponentDefinition"
- schema="zope.app.interfaces.utilities.content.IContentComponentDefinition"
+ schema=
+ "zope.app.interfaces.utilities.content.IContentComponentDefinition"
name="editpermissions.html"
template="permission_edit.pt"
class=".content.ContentComponentPermissionEdit"
menu="zmi_views" title="Define Permissions"
+ permission="zope.ManageContent"/>
+
+ <editform
+ for="zope.app.interfaces.utilities.content.IContentComponentDefinition"
+ schema="zope.app.interfaces.utilities.content.IContentComponentMenuItem"
+ name="menuItem.html"
+ menu="zmi_views" title="Menu Item"
+ fields="menuId interface create title description permission
+ filter_string"
permission="zope.ManageContent"/>
<defaultView
=== Zope3/src/zope/app/browser/utilities/content.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/utilities/content.py:1.3 Sun Aug 17 02:06:01 2003
+++ Zope3/src/zope/app/browser/utilities/content.py Mon Aug 18 14:55:29 2003
@@ -15,6 +15,7 @@
$Id$
"""
+import copy
from zope.app import zapi
from zope.app.browser.form.add import AddView
from zope.app.browser.form.editview import EditView
@@ -107,8 +108,13 @@
self.context.contentName = content_name
utilities = zapi.getService(self.context, Utilities)
- matching = utilities.getRegisteredMatching(IContentComponentDefinition,
- type_name)
+ matching = utilities.getRegisteredMatching(IContentComponentDefinition)
+ # We do the filtering by name separately, since the
+ # getRegisteredMatching() only does a string find, not an exact match,
+ # which we desire here.
+ print matching
+ matching = filter(lambda m: m[1] == type_name, matching)
+
if not (matching and matching[0][2].active()):
raise ComponentLookupError, \
"No Content Component Definition named '%s' found" %type_name
@@ -123,8 +129,11 @@
def createAndAdd(self, data):
"""Create a Content Component Instance and add it to the container."""
+ schema = self.definition.schema
+ if self.definition.copySchema:
+ schema = copy.deepcopy(schema)
content = ContentComponentInstance(self.definition.name,
- self.definition.schema,
+ schema,
self.definition.permissions)
errors = []
for name, value in data.items():
More information about the Zope3-Checkins
mailing list