Re: API for setting/getting values on Dexterity content
Héctor Velarde <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
I agree with this; once you understand how behaviors work is not that
ugly... you can also use:
>>> hasattr(obj, 'title')
True
>>> obj.title = u'Foo'
which is completely explicit and Pythonic.
in this specific case I think we don't need those methods in the API,
but I think this doesn't work the same when you use annotations instead
of attributes:
http://docs.plone.org/external/plone.app.dexterity/docs/behaviors/schema-only-behaviors.html
I think adding documentation on how to set/get values on fields provided
by behaviors would be better.
best regards
On 22-10-2014 09:35, Robert Niederreiter wrote:
> It would hide the ZCA a little bit and debugging would be a lot easier.
> Consider the following example
>
> >>> obj.behaviors
> basic
> title
> description
> publication
> effective
> expires
>
> >>> basic = obj.behavior('basic')
> >>> IBasic.providedBy(basic)
> True
>
> >>> basic.title = u'Foo'
> >>> basic.title = u'Bar'
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
smime.p7s
(application/pkcs7-signature, 3.7 KB) - not displayed