Re: set() and get() of IField ignored in Dexterity?
Andreas Jung <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Johannes Raggam wrote: > On Mon, 2014-12-01 at 13:42 +0100, Andreas Jung wrote: >> David Glick (Plone) wrote: >>> On 11/30/14, 9:39 AM, Andreas Jung wrote: >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA1 >>>> >>>> I implemented an XML field for Dexterity >>>> >>>> https://bitbucket.org/onkopedia/zopyx.existdb/src/438c6daa6bf3f5ac0c0a08b602e1f9927ead058a/zopyx/existdb/dx/fields.py?at=dexterity >>>> >>>> which is working nicely with plone.schemaeditor. >>>> >>>> However: the set() and get() methods are completely >>>> ignored. Is there something in Dexterity by-passing >>>> these methods? >>>> >>>> - -aj >>>> >>> The default z3c.form data manager is z3c.form.datamanager.AttributeField >>> which just does setattr and getattr on the (possibly adapted) context. >>> If you want the field's get/set to be used, you'll either have to write >>> a custom data manager for your field, or use a custom content item class >>> that uses property descriptors. >> This is perhaps an option when you define your content-types in Python >> code but completely unusable for TTW content-types. > > The data manager would adapt a generic context and your specific field. > So, if you create this data-manager and create a TTW content type using > this field, it should use your data manager. I am using a custom data manager right now and this should work fine (in fact it does work fine with my prototype) for both content-types create TTW or programmatically. I am more concerned we now have a third (necessary) way for dealing with get/set operations where the storage handling can not be implemented through a behavior but instead on the field level or in this case through the data manager (which belong to the z3c.form widget level) on the completely improper framework level. I am not opening a new discussion here but I just need to mention that the set/get implementation in Dexterity is even more flawed that I first thought. I can deal with this on the application level...so don't fear a further shit storm from my side :-P Andreas ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk