[Zope] DTMLFile usage

fowlertrainer at anonym.hu fowlertrainer at anonym.hu
Mon Jan 19 11:51:36 EST 2004


Hello Alexis,

Monday, January 19, 2004, 3:58:13 PM, you wrote:

AR> fowlertrainer at anonym.hu wrote:
>> Hello zope,
>>   When I write this:
>>   class ....
>>     ....
>>     def index_html(self):
>>         "used to view content of the object"
>>         import Globals
>>         df=Globals.DTMLFile('www/index',globals())
>>         return df
>> 
>>   Zope is not rendering the result.
>> 
>>   When I write this:
>>   class ....
>>     ....
>>     import Globals
>>     index_html=Globals.DTMLFile('www/index',globals())
>> 
>>   Zope is rendering my dtml file in correct way.
>> 
>>   So: if I do same things, zope why don't do same results ???

AR> Look at problem this way, "if zope don't do same results, I'm doing the
AR> same thing?".

AR> The first index_html returns a DTMLMethod instance (IIRC), while the
AR> second one *IS* a DTMLMethod instance, and so, when called, renders the
AR> DTMLMethod.
AR> HTH

Sorry, but I don't understand it, how to change/choose my result in
product with programatic way (not in dtml).

I want to do like this:

1. get requests
2. if request has some plus tags, I parse them
3. if none tags, I show default index
4. if have tags, I show two or three merged dtml document, some
   variabled sections.
   (example: when the tag is ?cmd=make_print, I replace the css to
   another to easiest printing the document. Etc, etc)

So: how to I load an DTML document from file, and render it to string
    variable as structure ?

df1=Globals.DTMLFile('www/index1',globals())
df2=Globals.DTMLFile('www/index2',globals())
return df1+"\n"+df2

???

Thanx for advance.


-- 
Best regards,
 fowlertrainer                            mailto:fowlertrainer at anonym.hu




More information about the Zope mailing list