----- Original Message -----
From: "Tim Nash" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 21, 2007 7:17 PM
Subject: [Zope] How do I eval a variable within the acquisition path?
I apologize for the question (the zope area of my brain must need
coffee) but I can't find the answer in the zope book or in any of the
scripts posted to the zope cookbook.
I want to use a variable in a acquisition path.
So for example, from the zope book on scripts, imagine that
vaccinateplan() printed out a specific animals vaccination plan.
Now instead of saying 'LargeAnimals' and 'hippo' like so:
print context.Vet.LargeAnimals.hippo.vaccinateplan()
I want to do like this:
category = REQUEST.form['category']
animal = REQUEST.form['animal']
print context.Vet.category.animal.vaccinateplan()
but I get an Attribute Error. How do I eval a variable within the
acquisition path?
any items in a url after python script name will be placed into REQUEST.
Example:
if there is a python script called 'ptst' in the folder 'folderx'
then the url: www.xyz.com/folderx/ptst/a/b/c
will result in the python script "ptst" being run and the following entry
will be in REQUEST:
traverse_subpath ['a', 'b', 'c']
hth
Jonathan
_______________________________________________
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )