[Zope] python ignorance shining through...

Tony McDonald tony.mcdonald@ncl.ac.uk
Tue, 14 Sep 1999 12:33:05 +0100


Hi all,
I've got an external method that does an SQL lookup and retrieves 
(essentially) two fields, tagclass and content.
What I'm doing at the moment is;

if tagclass == 'modulecontributor':
   template_str = self.RENDER.modulecontributor.read_raw()
   template = DocumentTemplate.HTML(template_str)
   theresult = template(self, content=content)
   return theresult

How can I do something like;

try:
   template_str = self.RENDER.(the contents of tagclass).read_raw()
   template = DocumentTemplate.HTML(template_str)
   theresult = template(self, content=content)
   return theresult
except KeyError:
   return "no renderer for %s" % tagclass

any pointers gratefully received..
tone
 
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2