Re: API for setting/getting values on Dexterity content

Dylan Jay <djay-n0pU0XVUApFWk0Htik3J/[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
On 23 Oct 2014, at 11:49 am, [email protected] wrote:

> TTW read is possible through the default DX view. (Also from restricted python.)

sorry I meant setting.

see https://dev.plone.org/ticket/13366


> 
> -Asko
> 
> -----Original Message-----
> From: Dylan Jay <djay-n0pU0XVUApFWk0Htik3J/[email protected]>
> To: "Héctor Velarde" <[email protected]>
> Cc: plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Sent: to, 23 lokakuuta 2014 4:13
> Subject: Re: [Plone-developers] API for setting/getting values on Dexterity content
> 
> Keep in mind that attribute assignment doesn't work in either xmlrpc or restricted python so dexterity can't be used with ttw or via RPC at all. 
> 
> On 22 Oct 2014 21:45, "Héctor Velarde" <[email protected]> wrote:
> 
> 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
> 


------------------------------------------------------------------------------
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.