Hi. Somebody know how to do instead: someFoo = DTMLFile('file', globals()) def someFoo(self, REQUEST = None): """abc""" myDTML = "<standard_html_header>Test!<standard_html_footer>" return myDTML Yes, I know: I should render it first. But how? I didn't find (yet) any DTMLString or something. Any hints? -- Regards, Bogdan Never assume the reader has read the subject line.
Bo M. Maryniuck wrote:
Somebody know how to do instead:
someFoo = DTMLFile('file', globals())
def someFoo(self, REQUEST = None): """abc""" myDTML = "<standard_html_header>Test!<standard_html_footer>" return myDTML
Easy if you know how... ###### from Globals import HTML class SomeClass: someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') ##### Zope will call it and pass parameters ... regards Max M
<evolve>
On Wednesday 09 October 2002 15:46, Max M wrote:
Easy if you know how... Yeah...
from Globals import HTML Cool. But who knows that to parse *DTML* I should search for *HTML*? :)
-- Regards, Bogdan Never trust an operating system you don't have sources for.
Bo M. Maryniuck wrote:
On Wednesday 09 October 2002 15:46, Max M wrote:
Easy if you know how...
Yeah...
from Globals import HTML
Cool. But who knows that to parse *DTML* I should search for *HTML*? :)
Well actually DTMLFile is decapricated. You should use HTMLFile instead. That could have given a clue. But you are right. Not all is logical. regards Max M
<evolve>
On Wednesday 09 October 2002 15:46, Max M wrote:
###### from Globals import HTML class SomeClass: someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') #####
Errm... Be exact. Perhaps this way: from Globals import HTML class SomeClass: def foo(self, REQUEST = None): """blah""" someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') return someFoo(self, self.REQUEST) -- Regards, Bogdan When in danger, or in doubt, run in circles, scream and shout. -- Robert A. Heinlein
Bo M. Maryniuck wrote:
On Wednesday 09 October 2002 15:46, Max M wrote:
###### from Globals import HTML class SomeClass: someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') #####
Errm... Be exact. Perhaps this way:
from Globals import HTML class SomeClass: def foo(self, REQUEST = None): """blah""" someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') return someFoo(self, self.REQUEST)
Well that depends on what you are trying to do. The way you are doing it you compile somFoo every time it is used. You should at least make it a class attribute: from Globals import HTML class SomeClass: someFoo = HTML('<standard_html_header>Test!<standard_html_footer>') def foo(self, REQUEST = None): """blah""" return self.someFoo(self, self.REQUEST) But then you could just as well call it "foo" and bypass the ekstra function call: from Globals import HTML class SomeClass: foo = HTML('<standard_html_header>Test!<standard_html_footer>') And then we are back where we started ;-) regards Max M
<evolve>
Don't know if you've got the answer yet but here's the answer: def index_html(self, *arg, **kw): " Zope __str__ " return DTMLFile('index', globals(), mapping=kw).__of__(self)() This is useful if you wanna make the following modifications: def index_html(self, *arg, **kw): " Zope __str__ " if self.REQUEST.SomeLanguage=='se': file = 'index.se' else: file = 'index.en' return DTMLFile(file, globals(), mapping=kw).__of__(self)() At 15:15 2002-10-09 +0200, Bo M. Maryniuck wrote:
Hi. Somebody know how to do instead:
someFoo = DTMLFile('file', globals())
def someFoo(self, REQUEST = None): """abc""" myDTML = "<standard_html_header>Test!<standard_html_footer>" return myDTML
Yes, I know: I should render it first. But how? I didn't find (yet) any DTMLString or something. Any hints?
-- Regards, Bogdan
Never assume the reader has read the subject line.
_______________________________________________ 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 )
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.391 / Virus Database: 222 - Release Date: 2002-09-19
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.391 / Virus Database: 222 - Release Date: 2002-09-19
participants (3)
-
Bo M. Maryniuck -
Max M -
Peter Bengtsson