[Product-Developers] Re: managing vocabularies for dexterity types
athomerson
athomerson at sympatico.ca
Thu Jan 28 19:42:13 UTC 2010
Kees,
I have used some code that A. Clark wrote as the template for the vocabulary
stuff I am writing for my Dexterity types. The code looks like this:
@grok.provider(IContextSourceBinder)
def salutations(context):
terms = []
pprop = getToolByName(context, 'portal_properties')
for t in pprop.client_properties.salutations:
terms.append(SimpleVocabulary.createTerm(t, str(t), t))
return SimpleVocabulary(terms)
class IClient(form.Schema):
"""A client. Clients have multiple addresses.
"""
salutation = schema.Choice(
title=_(u"Salutation"),
source=salutations,
required=False,
)
And then in the profiles/default directory I have a "propertiestool.xml"
file that looks like this:
<?xml version="1.0"?>
<property name="title">ins.client Property Sheet</property>
<property name="salutations" type="lines" purge="False">
<element value="Mr."/>
<element value="Ms."/>
<element value="Dr."/>
<element value="Rev."/>
</property>
I think the "purge" property keeps any changes from being lost on a
re-install. I can then create a view with the appropriate permissions to
update the property sheet (just to keep things neat and users out of the
ZMI).
Allen
--
View this message in context: http://n2.nabble.com/managing-vocabularies-for-dexterity-types-tp4473825p4475579.html
Sent from the Product Developers mailing list archive at Nabble.com.
More information about the Product-Developers
mailing list