[Product-Developers] Re: schemaextender issue: Unauthorized: You are not allowed to access 'set' in this context
Martin Aspeli
optilude at gmx.net
Sat Jan 26 01:12:24 UTC 2008
>> there are no generated methods with schemaextender.
>>
>
> On purpose or because of problems?
On purpose.
> What happens if you call ClassGen's 'generateMethods' for the
> new fields?
>
> (sorry I've not been following atse
> development that closely)
A mess. It's like monkeypatching classes with new methods at runtime.
You can have extenders that behave differently in different scenarios
(e.g. when a particular marker interface is set), but generateMethods
works on a class level.
ContentFlavors tried to monkey patch on an instance level, but it got
very complicated.
However, in this case, it may be possible to do:
context.getWrappedField('myfield').set(context, val)
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Product-Developers
mailing list