[Zope-CMF] Create new portal property with a Python script

Hans Schou hans at mmmanager.org
Tue Feb 14 05:59:30 EST 2006


Andreas Jung wrote:

>
>
> --On 14. Februar 2006 10:20:24 +0100 Hans Schou <hans at mmmanager.org> 
> wrote:
>
>> Hi
>>
>> A very new into Zope/CMF/Plone so it might be a silly question I have.
>>
>> I have installed PloneMall. In that there is a tool which is called
>> portal_ordermanager. If I open that I can go to the Properties tab, and
>> in that I can add a new property which is of the type "lines" and 
>> another
>> one of the type "selection".
>>
>
> Look at the PropertyManager API (as documented in the Zope Book 2.7 
> edition,
> Appendix A or B), manage_addProperty()...or grep through existing 
> source...there are enough code examples.
>
Thanks for the quick answer. It helped me a lot.

I got one little problem left. How do I assign a variable of the type 
"selection" the value of index 0 in the list?
I get the error: attribute-less object (assign or del)
As I understand, pom.Ewire should be of the type string.

pom = getToolByName(context, 'portal_ordermanager', None)
pom.manage_addProperty("EwireIDURL",("7055547 
secure.test.ewire.dk","7059999 secure.ewire.dk"),"lines")
pom.manage_addProperty("Ewire","EwireIDURL","selection")
pom.Ewire = pom.EwireIDURL[0]    # I get an error here on this line
print pom.Ewire  # when the variable is set, this line works fine


best regards
hans


More information about the Zope-CMF mailing list