Re: API for setting/getting values on Dexterity content

Johannes Raggam <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
On Wed, 2014-10-22 at 23:50 +0200, Jens W. Klein wrote:
> On 2014-10-22 14:07, Andreas Jung wrote:
> >
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> >
> >>
> >> So setting/getting a schema value could be (based on Andreas'
> >> suggestion): plone.api.content.set_value(obj, fieldname,  value,
> >> behavior='behavior_name') value = plone.api.content.get_value(obj,
> >> fieldname, behavior='behavior_name')
> >>
> >> Same for Dexterity base classes: obj.set_value(fieldname, value,
> >> behavior='behavior_name') value = obj.get_value(fieldname,
> >> behavior='behavior_name')
> >>
> >>
> >
> > Why do you want the behavior name as explicit part of the API?
> > My position is that this should be handled under the hood.
> 
> Well, its easy to iterate over main schema and behaviors to get the 
> field name, i really dont get why everyone want to have the behavior 
> name in the api. Maybe its not the fastest way to get the value, but if 
> someone care about speed he/she can do the direct access way for the 
> specific case anyway.

something like this code snippet in here:
https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/utils.py#L134

again, this doesn't solve conflicting field names from different
behaviors.


> Jens
> 

-- 
programmatic  web development
di(fh) johannes raggam / thet
python plone zope development
plone framework  team  member
mail: office-//[email protected]
web:  http://programmatic.pro
      http://bluedynamics.com

------------------------------------------------------------------------------

_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEABECAAYFAlRIRHQACgkQW4mNMQxDgAd0TgCfWY52LKOwuM7v99wpa6B1q8p+
NUwAn3MlndCnX1W7h1HvYYJbUpI7NcyN
=vHoR
-----END PGP SIGNATURE-----
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.