A DTMLFile is an object that explicitly requires an acquisition context (for security). There is another class that you can import named HTMLFile (from the same place as DTMLFile) that I believe will do what you want to do. It doesn't appear to require an acquisition context and it has roughly the same signature. If this fails, you can use the DocumentTemplate.HTML class directly and just pass in "raw" DTML to its constructor. - C On Mon, 2002-12-09 at 19:48, Terry Hancock wrote:
If in the torrent of messages you happened to notice ;-D, I'm implementing a class wrapper around an SQL result within a Zope product -- this now works thanks to the kind suggestion by Chris McDonough. Now that the wrapping part works, I've exposed another problem -- the main sort of method I want is one that renders the data into HTML for display purposes (i.e. the object draws itself).
I was planning to use DTML for this, seeing as that's what's used elsewhere in the application. But when I try to render/run DTMLFile() methods in the wrapper I get complaints about acquisition failures (an error occurs in aq_parent()). Now I could probably go through some hoops to make acquisition happen (that is, give the object an acquisition parent) -- but actually, I don't need it -- all the variables I want rendered are attributes of the wrapper class. If I wanted to, I could give up on DTML and just use a Python format string.
myform = """My stuff with %(data) inserted.""" % locals()
instead of
myform = DTMLFile("dtml/myform", globals(), **locals())
where dtml/myform is: """ My stuff with &dtml-data; inserted. """
However, that would break the "minimize the languages" rule -- I'd now have to use two different template systems in the same product. (I mainly mention it to prove the point that I don't need acquisition).
Can I invoke DTML w/o invoking the acquisition mechanism (or at least tell the acquisition mechanism not to try to find a parent for my class)?
I don't see how one could do this with DTMLFile, is there a way by actually invoking the DTMLMethod() constructor?
Thanks for any suggestions! Terry
-- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
"Some things are too important to be taken seriously"
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )