[Zope-CMF] Content Type Registry Improvement

Sidnei da Silva sidnei at enfoldsystems.com
Mon Jul 25 14:28:10 EDT 2005


I'm trying to write a Content Type Registry predicate that needs
access to the context to be able to decide what content type to
create, however in ContentTypeRegistry, findTypeName, the predicate is
not wrapped in acquisition when called.

I would like to propose to wrap the predicate into an acquisition
context before calling it so that smarter predicates can be created.

Here's the proposed change:

Index: ContentTypeRegistry.py
RCS file:
retrieving revision
diff -u -r1.14.10.2 ContentTypeRegistry.py
--- ContentTypeRegistry.py      23 Apr 2004 21:11:33 -0000
+++ ContentTypeRegistry.py      25 Jul 2005 18:30:04 -0000
@@ -538,6 +538,7 @@
         for predicate_id in self.predicate_ids:
             pred, typeObjectName = self.predicates[ predicate_id ]
+            pred = pred.__of__(self)
             if pred( name, typ, body ):
                 return typeObjectName

Sidnei da Silva
Enfold Systems, LLC.

More information about the Zope-CMF mailing list