[Zope-CMF] accessing archetypes fields value knowing an id
J. Cameron Cooper
jccooper at jcameroncooper.com
Mon Jan 12 19:17:29 EST 2004
mulamba kamahunda wrote:
>with a python script,
>how can i get the values of the propreties of an
>archetypes object knowing its Id.
>I mean, I passed a parameter ObjId to a python script
>which has to do for example
>Objid.getFieldValue()
>isn't there any method like portal_....getObjectById
>?.....
>
You really mean, I think, "how do I get a handle on an object knowing
only its id?"
There are many ways: see ZopeLabs for some examples. Here is one way to
look up an object in the current context::
elt = context[ObjId]
elt.getFieldValue()
You could also use the catalog or the Archetypes reference service to
try to look up an object of that id anywhere in the portal.
--jcc
--
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."
More information about the Zope-CMF
mailing list