Re: API for setting/getting values on Dexterity content
"Jens W. Klein" <jens-/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Organization | Klein & Partner KG |
| Message-ID | <[email protected]> |
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. Jens -- Klein & Partner KG, member of BlueDynamics Alliance ------------------------------------------------------------------------------