On 6/3/09 10:08 AM, Charlie Clark wrote:
> Am 02.06.2009 um 14:47 schrieb Wichert Akkerman:
>> That assumes the object has already been constructed and you're only
>> testing constraints for adding the instance to the container. Our use
>> case is different: we are testing at a point where construction has
>> not happened yet.
> I think there are two things to consider here:
> 1) can I create the object at all?
> 2) can I add it to a particular container?
> so yuppies' reference to checkFactory and checkObject are definitely
> the places to start. Your use case refers not to object creation but
> containment depths so you're not checking the factory as whether you
> can create the object but the container as to whether it may contain
> the object. Surely extending the sample class to count your
> containment depth will solve the problem: raise the error and rollback
> the transaction?
There are two reasons I want to block creation of the object:
performance, and user interface. The last one is more critical: the
add-item menus used in Plone (and I suspect CMF as well) look for all
object types that can be constructed in the current location. Obviously
you do not want to do that by creating all possible objects and testing
if you can add them to the container, so we need a way to test if
creating an object and adding it to the current container is allowed
without creating objects.
Zope-CMF maillist - Zope-CMF@lists.zope.org
See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests