[Zope-CMF] Accessing the "context"

Andrew Sawyers andrew at sawdog.com
Tue Oct 30 12:02:31 EDT 2007


Wichert Akkerman wrote:
>>> da = getattr('my_da_or_what_ever', context, None)
>>>       
>
> getattr(context, 'my_da_or_what_ever', None) works a bit better.
>   
Note that getattr('foo', context, None) is wrong.
Wichert has the correct syntax; I didn't even pay attention to the 
syntax originally. :)
>   
>> Doesn't that only work within a PythonScript? I need access from  
>> within a content type, ie. real Python code?
>>     
>
> It's called acquisition and it works everywhere. Try it.
>
> Wichert.
>
>   
Andrew


More information about the Zope-CMF mailing list