[Zope-CMF] Portal users and some other stuff
Charlie Clark
charlie at begeistert.org
Thu Jan 11 17:28:39 EST 2007
Hi,
my shiny new content type is now working pretty much as expected.
Thanks to Tres and Jens for pointing me in the right direction and
giving me encouraging nudges.
For the necessary forms, at least based on the CMF Event code, it
seems to me that code like
options['title'] = form.get('title', context.Title())
options['text'] = form.get('text', context.text)
options['text_format'] = form.get('text_format', context.text_format)
options['headline'] = form.get('headline', context.headline)
options['teaser'] = form.get('teaser', context.teaser)
options['category'] = form.get('category', context.category)
options['keywords'] = form.get('keywords', context.keywords)
options['resources'] = form.get('resources', context.resources)
could be optimised in the context could be treated as a dictionary
object, ie. supported get.
ie.
attrs = ['headline', 'teaser', 'category']
optins = {}
# assign attributes that do not require additional processing
for attr in attrs:
options[attr] = form.get(attr, context.get(attr))
# attributes that need special treatment...
I was initially confused that the context was the same as the
instance of my content-type and didn't support this as I use this
idiom quite frequently to reduce my typos. Is this too much of an
edge case to warrant the extension in general (but I'm free to do it
myself) or perhaps an outdated methodology?
If I need to add attributes to portal users such as their full name,
is it best to customise the member object for my site or to use a
plugin?
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
More information about the Zope-CMF
mailing list