robert rottermann wrote:
Charlie Clark schrieb:
Dear all,

a simple question with hopefully a simple answer! How do I access
objects from an object's context or hierarchy? Specifically I'd like to
be able to access a ZopeDA connection for a site.

if you know the id of the object you are looking for beforehand you can
get it by just requesting it from the context like:

da = getattr('my_da_or_what_ever', context, None)
if da:

minor nit:

i strongly recommend "if da is not None" rather than just "if da".

if your 'da' object was a containerish object with no contained objects, then it would evaluate to False even though the object really existed. it's generally unwise to assume that an object will evaluate to True just because it exists.


Zope-CMF maillist  -

See for bug reports and feature requests

Reply via email to