Hello zope, I don't understand why the zope render some objects, and not render others. I have been used an minimal product to test it: 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 ??? The calling zpt is this: <p tal:replace="structure here/minimal/index_html"/> -- Best regards, fowlertrainer mailto:fowlertrainer@anonym.hu
fowlertrainer@anonym.hu wrote:
Hello zope,
I don't understand why the zope render some objects, and not render others.
I have been used an minimal product to test it:
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 ???
Look at problem this way, "if zope don't do same results, I'm doing the same thing?". The first index_html returns a DTMLMethod instance (IIRC), while the second one *IS* a DTMLMethod instance, and so, when called, renders the DTMLMethod. HTH -- //// (@ @) ---------------------------oOO----(_)----OOo------------------------ Los pecados de los tres mundos desapareceran conmigo. Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain) --------------------------------------------------------------------
Alexis Roda wrote:
fowlertrainer@anonym.hu wrote:
Hello zope,
I don't understand why the zope render some objects, and not render others.
I have been used an minimal product to test it:
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 ???
Look at problem this way, "if zope don't do same results, I'm doing the same thing?".
The first index_html returns a DTMLMethod instance (IIRC), while the second one *IS* a DTMLMethod instance, and so, when called, renders the DTMLMethod.
With the correction that it's DTMLFile objects not DTMLMethod. They are not the same. -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM Skype: colliberty
Hello Alexis, Monday, January 19, 2004, 3:58:13 PM, you wrote: AR> fowlertrainer@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@anonym.hu
fowlertrainer@anonym.hu wrote:
So: how to I load an DTML document from file, and render it to string variable as structure ?
For starters, not really sure why you're doing this as a python product. Probably easier to just do it as a Script (Python)....
df1=Globals.DTMLFile('www/index1',globals()) df2=Globals.DTMLFile('www/index2',globals())
Don't do these in the metho, do them in the global moduel context (ie: don't indent them!)
return df1+"\n"+df2
return df1(self,self.REQUEST)+"\n"+df2(self,self.REQUEST) cheers, Chris
Hi, fowlertrainer@anonym.hu wrote:
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())
In both cases, index_html is only called once and it's result is returned to the browser. Your first example would work if you did: def index_html(self): "used to view content of the object" import Globals df=Globals.DTMLFile('www/index',globals()) return df(self) ...but your second example is "the right way"... cheers, Chris BTW: Whereabouts in Hungary are you?
participants (4)
-
Alexis Roda -
Chris Withers -
fowlertrainer@anonym.hu -
Johan Carlsson