[Zope-CMF] Re: Content Type Registry Improvement

Tres Seaver tseaver at palladion.com
Mon Jul 25 16:06:03 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sidnei da Silva wrote:
> Hi,
> 
> 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:
> /cvs-repository/Products/CMFCore/Attic/ContentTypeRegistry.py,v
> retrieving revision 1.14.10.2
> diff -u -r1.14.10.2 ContentTypeRegistry.py
> --- ContentTypeRegistry.py      23 Apr 2004 21:11:33 -0000
> 1.14.10.2
> +++ 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
> 
> 

Looks fine.  Can you add it with a test?


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC5UYr+gerLs4ltQ4RArFfAJ4qWD+TYDKa22VcjUjYYLl5Y3F9cgCg1x/S
J1gVCReTO2vEKqE9vY2i6kk=
=Mfnx
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list