[Zope3-checkins] CVS: Zope3/src/zope/app/schemacontent/browser -
__init__.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 17 10:33:35 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/schemacontent/browser
In directory cvs.zope.org:/tmp/cvs-serv16896/src/zope/app/schemacontent/browser
Modified Files:
__init__.py
Log Message:
Get rid of getRegisteredMatching().
=== Zope3/src/zope/app/schemacontent/browser/__init__.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/schemacontent/browser/__init__.py:1.4 Sat Mar 13 20:11:41 2004
+++ Zope3/src/zope/app/schemacontent/browser/__init__.py Sat Apr 17 10:33:35 2004
@@ -111,23 +111,20 @@
self.context.contentName = content_name
utilities = zapi.getService(self.context, Utilities)
- 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)
+ matching = [util
+ for name, util in utilities.getUtilitiesFor(
+ IContentComponentDefinition)
+ if name == type_name]
- if not (matching and matching[0][2].active()):
+ if not matching:
raise ComponentLookupError, \
"No Content Component Definition named '%s' found" %type_name
- self.definition = matching[0][2].active().getComponent()
+ self.definition = matching[0]
self.schema = self.definition.schema
self.label = 'Add %s' %self.definition.name
super(AddContentComponentInstanceView, self).__init__(self.context,
request)
-
return self.generated_form
def createAndAdd(self, data):
More information about the Zope3-Checkins
mailing list