getitem in pythonscript
hi what's the equivalent of _.getitem(stuff) in python script? the only way i know of is by binding _, and refer to it as ob=_.getitem(stuff) is this the *only* way? thanks
this: object = getattr(context, 'index_html') ----- Original Message ----- From: "bak (kedai)" <kedai@kedai.com.my> To: <zope@zope.org> Sent: Tuesday, May 01, 2001 9:23 AM Subject: [Zope] getitem in pythonscript
hi what's the equivalent of _.getitem(stuff) in python script? the only way i know of is by binding _, and refer to it as ob=_.getitem(stuff)
is this the *only* way?
thanks
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I'm using __getitem__ inside a script like so: objectRendered = workDir.__getitem__(docs) where workDir is a container and docs is a string Does that do what you're looking for?
From: bak (kedai) <kedai@kedai.com.my> Date: Tue, 1 May 2001 15:23:31 +0800 To: zope@zope.org Subject: [Zope] getitem in pythonscript
hi what's the equivalent of _.getitem(stuff) in python script? the only way i know of is by binding _, and refer to it as ob=_.getitem(stuff)
is this the *only* way?
thanks
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
From: "bak (kedai)" <kedai@kedai.com.my>
what's the equivalent of _.getitem(stuff) in python script?
_.getitem implements a lot of namespace magic, including complex lookup rules and automatic rendering. There are more explicit substitutes, though: 1. getattr(object, stuff): Use if you know which object (context or container, for instance) has an attribute that you are looking for, or can acquire it. 2. f[stuff]: Use to get an object contained in Folder "f". 3. container.REQUEST.get(stuff): Use to get a value from the REQUEST. Cheers, Evan @ digicool & 4-am
participants (4)
-
bak -
Chris Muldrow -
Evan Simpson -
Peter Bengtsson