How to render a HTMLFile in a method in a product
I would have thought that the two examples below where equivalent but only the top one works like expected. (It renders the page.) The second one just shows the source of the vanilla dtml page. -- test = HTMLFile('vanilla', globals()) -- def test(self): "A simpe test method" return HTMLFile('vanilla', globals()) -- How do I execute the dtml file in a method. I have searched the documentation, but it is sketchy to say the least. I cannot use the first approach as I need to define the filename on the fly in my method. def test(self): "A simpe test method" return HTMLFile('skins/' + self.skin, globals()) self.skin is only available in my object, so naturally if I try to say: test = HTMLFile('skins/' + self.skin, globals()) I get an error. Regards Max M
Max Møller Rasmussen wrote:
def test(self): "A simpe test method" return HTMLFile('skins/' + self.skin, globals())
This is the closest. try the following: testisDocTemp = 1 def test(self,ignored,md): " A simple test method " return HTMLFile('skins/' + self.skin, globals())(None,md) cheers, Chris
participants (2)
-
Chris Withers -
Max Møller Rasmussen