[ZPT] Re: How Do I Use ZPT Output In Python Code?
Shane McChesney
shane@nooro.com
Mon, 12 Aug 2002 14:00:07 -0400
Hi all,
I got to talk with Michael Bernstein today, co-author of
The Zope Bible, and together he and I (okay, mostly he,
thanks, Michael) came up with this solution to my problem:
-----------------------------------------------
def setQuestionUI(self, REQUEST =3D None):
"""
Generate the appropriate XHTML representation for
this question and store it in a string property for
manual editing and later use in end-user-facing ZPTs.
"""
self.thePTFile =3D PageTemplateFile('www/viewQuestion',
globals(), __name__ =3D 'thePTFile')
self.QuestionUI =3D self.thePTFile()
if REQUEST is not None:
return self.manage_main(self, REQUEST)
-----------------------------------------------
Initial tests get me exactly the result I want, dynamically
generated XHTML in an object property so I can edit it
freely in the ZMI and then include it in the final ZPTs
later.
Hopefully there are no other unseen hurdles here.
Sorry if my tabs and equals signs all end up getting
escaped as in the previous email. Not sure what's up with
that.
Thanks for your time,
Shane McChesney
http://www.skippingdot.net
Most recent post on Zope:
http://www.skippingdot.net/2002/07/04