Re: How to edit dexterity types without needing to know about their behaviors

"Martin Aspeli" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <1394719108444.c6fd5084@Nodemailer>
createContent doesn't magically guess attributes, but you can set things by dotted name if memory serves.


The point is that no matter what you need to know what you're looking for. Our way of expressing that is via interfaces. The object either claims or doesn't claim to implement an interface which promises attributes.




Martin
—
Sent from Mailbox for iPhone

On Thu, Mar 13, 2014 at 1:56 PM, Asko Soukka <[email protected]> wrote:

> 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

_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.