Re: [Zope] using a DTMLFile in a python product method
Casey, . Thanks for the quick response. I tried calling it using apply, but I couldn't get the call right. It looked like other code called something like apply(DTMLFile(file,globals()),(),kw) but I don't know what arguments it needs--if it works without arguments, I don't think I tried that. Anyway, if that's the correct approach, I'll play around with it some more until I get it to work. Thanks again, Matt Wilbert mwilbert@alum.mit.edu -----Original Message----- From: Casey Duncan cduncan@kaivo.com Sent: Wed, 20 Jun 2001 10:20:32 -0600 To: mwilbert@alum.mit.edu CC: zope@zope.org Subject: Re: [Zope] using a DTMLFile in a python product method Matthew Wilbert wrote:
I have a method in a python product where I return different forms based upon a REQUEST parameter. If I construct the returned html as a python string and return it, it works fine. But it seems more sensible to save the html as a template and then return that. So I created a template file, and used it to create a DTMLFile instance. The problem is that if I return this instance, it is returned html-quoted, which isn't what I want. Looking at the code, I can see this is the expected behavior if you convert it to string, but that isn't being done, explicitly.at least.
Anyone know how to get it to show up unquoted?
Matt Wilbert mwilbert@alum.mit.edu
It would seem you are returning the DTMLFile object itself. I would suggest returning the rendered result of the object instead by calling it and returning the resulting data. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------> ___________________________________________________________________________ Visit http://www.visto.com/info, your free web-based communications center. Visto.com. Life on the Dot.
Matthew Wilbert wrote:
Casey, . Thanks for the quick response.
I tried calling it using apply, but I couldn't get the call right. It looked like other code called something like
apply(DTMLFile(file,globals()),(),kw)
but I don't know what arguments it needs--if it works without arguments, I don't think I tried that.
Anyway, if that's the correct approach, I'll play around with it some more until I get it to work.
Thanks again,
Matt Wilbert mwilbert@alum.mit.edu
I think it is much like calling a DTML Method, assuming it doesn't need much of a namespace, this should work: DTMLFile(DTMLFile, kw=kw) You can omit the latter argument if you don't need to pass it any keyword arguments, or pass directly as in: DTMLFile(DTMLFile, arg1='foo', arg2='bar') -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (2)
-
Casey Duncan -
Matthew Wilbert