Laurence Rowe wrote:
> 2009/12/17 Mikko Ohtamaa<mi...@redinnovation.com>:
>> I need to have little clarification should properties work on
>> Persistent objects. I am running ZODB 3.8.4 on Plone 3.3.
>> I am using plone.behavior and adapters to retrofit objects with a new
>> behavior (HeaderBehavior object). This object is also editable through
>> z3c.form interface. z3c.form requires a context variable on the object
>> e.g. to look up dynamic vocabularies. To avoid having this
>> object.context attribute to be peristent (as it's known every time by
>> the factory method of the adapter which creates/look-ups
>> HeaderBehavior) I tried to spoof context variable using properties and
>> internal volatile variable. This was a trick I learnt somewhere
> This sounds like you are passing context somewhere where view is expected.
Yeah, to me as well it sounds like you're barking up the wrong tree
here. You shouldn't need any kind of faking like this.
"z3c.form requires a context variable on the object
e.g. to look up dynamic vocabularies"
This isn't right: a z3c.form form is just a view like any other. It is
looked up on the context and the request. In Dexterity (which I assume
you're using?), that's going to be the content object.
I think you need to take a step back and look at how your form is set
up, not dive into deep magic of persistence.
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org