[Zope-CMF] allowedContentTypes slowness

alan runyan runyaga at runyaga.com
Wed Dec 17 18:31:54 EST 2003

> Developers, developers,

/me envisions monkey balmer jumping around

> Did some profiling of Plone on a customer site last night, and along 
> with Tesdal I discovered that allowedContentTypes is called *twice* on 
> any page render, and it's one of the most expensive methods in the 
> CMF.

this is fixed in Plone-2_0-branch.

> We reduced it to only being called once, but still - it's the most 
> expensive part of a template when anything is rendered.

correct.  and it should never be called for anonymous users by default. 
  atleast it should
not be called each request.

> Tesdal commented that the method in CMF again and again checks whether 
> the product and the factory exists, is it possible to make this one 
> call instead of multiple? I assume it's pretty expensive:
> if getSecurityManager().validate(p, p, self.factory, m):
> Is there anything that can be done about this? I'm not a kick-ass 
> optimizer, but maybe somebody can comment on this? :)

well.  either in Plone or in CMF we need to allow Portal/Plone folders 
to be able to
override this method to constrain what content types can be created per 
Folder instance.
currently its too coarse grain for InfoArchitects to constrain what 
content can be added to
specific folders (currently you end up w/ portal_type explosion).

actually thinking about the caching implications of this is rather 
ugly.  not sure the
best way of fixing this.  we could hedge out and skip the checks for 
people with
'Manager' role.

> (cross-posted to Plone-dev and CMF lists, I assume we both are 
> interested.)

hello everybody.  have a good xmas.


More information about the Zope-CMF mailing list