[Zope] manageAddProperty for a Multiple Selection in a Python Script

complaw@hal-pc.org complaw@hal-pc.org
Tue, 29 Jan 2002 18:04:43 GMT


A python script is attempting to add a DTML Document to a folder.  The folder
has a property called "select_keywords" which, as the name implies, is a list of
keywords for the user.  

A form is in the folder to allow the user to add informaiton.  In the form is a
list of the keywords from the select_keywords property of the form (the
parameter is called 'user_keywords').  The user can then select the appropriate
keywords and press the Submit button.

The python script then creates a new DTML Document object and then attempts to
add a multiple selection property to the new DTML Document object.  In doing so,
the object is created, but there is no link to the newly created multiple select
property (called my_keywords) and the select_keywords property.

The code...

my_obj = getattr(context, id)
my_obj.manageAddProperty('my_keywords', user_keywords, 'multiple selection',
select_keywords)

... runs correctly, but the link between my_keywords and select_keywords is
nott established, so Zope cannot use that field.

The code...

my_obj = getattr(context, id)
my_obj.manageAddProperty('my_keywords', user_keywords, 'multiple selection',
select_variable='select_keywords')

.. generates an error (complaining about "select_variable").


Does anyone know the trick to make this work properly?

Thanks in advance,

Ron

select_variable =
select_keywords