Re: How to edit dexterity types without needing to know about their behaviors
Asko Soukka <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Wichert Akkerman wrote: > On 13 Mar 2014, at 14:22, Johannes Raggam <[email protected]> wrote: >> On Thu, 2014-03-13 at 14:13 +0100, Wichert Akkerman wrote: >>> On 13 Mar 2014, at 14:08, Martin Aspeli <[email protected]> wrote: >>>> I don't understand the problem. How would magic attribute resolution be better than something described in an interface using the adapter patten? >>> Why is an adapter necessary for standard attributes like the start time for an event? I don’t understand that part. >> look here: >> https://github.com/plone/plone.app.event/blob/master/plone/app/event/dx/behaviors.py#L341 > > Why not just use an event base class or mixin instead of a behaviour? That way you get the property normally and don’t force people to play adapter-games. As I interpreted the issue from Andreas' post, we have now different "classes" of attributes. Some can be accessed and set directly without adaptation. Other cannot. There's now way to know it for sure, so the only right way would be to set everything through the adaptation. Then again, we have misleading examples like e.g. plone.dexterity.utils.createContent, which just sets all the given attributes directly. To make that harder, some fields may require special values (like RichTextValue). Personally, I like the way Dexterity works, and how we can avoid issues with custom object classes. Still, there is some extra learning curve. -Asko ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech