Tim Nash schrieb: > 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() print context.Vet[category] or print getattr(context.Vet, category, 'some default value') hth robert
begin:vcard fn:Robert Rottermann n: Rottermann;Robert email;internet:[EMAIL PROTECTED] tel;work:++41 31 333 10 20 tel;fax:++41 31 333 10 23 tel;home:++41 31 333 36 03 x-mozilla-html:FALSE version:2.1 end:vcard
_______________________________________________ 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 )
