[Zope3-Users] NameChooser functionality for IContainerNamesContainer

Joel Moxley jfmoxley at gmail.com
Mon Jan 16 12:00:03 EST 2006


I successfully added a name chooser for objects added through an add
form to my container.  This involved implementing
IContainerNamesContainer on my container, INameChooser on my
NameChooser, registering each, and being sure to set my set_before_add
fields in the addform registration.

What is The Right Way (tm) to use this NameChooser functionality
outside of the addform?  In other words, I have a method that defines
the container from a file as follows:

self[name] = obj

This obviously would overwrite duplicates, etc.  I would prefer to
have something as follows which would use the NameChooser machinery
automatically (ie, without having to get the NameChooser adapter in my
method).  Is there a way I can do something along the lines of this?

self.add(obj)

Thanks,
J


More information about the Zope3-users mailing list