<dtml-var foo> vs. <dtml-var expr="foo()">
A newbieish question. I thought <dtml-var foo> and <dtml-var expr="foo()"> were the same thing. Seems they are not: Depending on the way foo is called something differs in the environment they run in. Given the following situation: I have an dtml-method foo = <dtml-var bar> And dtml-method bar <dtml-var baz> Plus a third method baz <p>Pazaa!</p> Now viewing foo does exactly what you think it does: It goes calls bar which calls baz which returns the text <p>Pazaa!</p> Now change the first method foo: <dtml-var expr="bar()"> And you'll get KeyError: baz Does somebody understand what is going on? My real-world situation is that I need to specify a path, which as far as I know forces me to use the expr="Pat.to.my.bar()" alternative. Or does it not? Juho Vuori
if your path is fixed try: <dtml-with Path> <dtml-with to> <dtml-with my> <dtml-var bar> </dtml-with> </dtml-with> </dtml-with> Jonathan ----- Original Message ----- From: "Juho Vuori" <juho.vuori@kepa.fi> To: <zope@zope.org> Sent: January 20, 2004 9:26 AM Subject: [Zope] <dtml-var foo> vs. <dtml-var expr="foo()">
A newbieish question. I thought <dtml-var foo> and <dtml-var expr="foo()"> were the same thing. Seems they are not: Depending on the way foo is called something differs in the environment they run in.
Given the following situation:
I have an dtml-method foo = <dtml-var bar>
And dtml-method bar <dtml-var baz>
Plus a third method baz <p>Pazaa!</p>
Now viewing foo does exactly what you think it does: It goes calls bar which calls baz which returns the text <p>Pazaa!</p>
Now change the first method foo: <dtml-var expr="bar()">
And you'll get KeyError: baz
Does somebody understand what is going on?
My real-world situation is that I need to specify a path, which as far as I know forces me to use the expr="Pat.to.my.bar()" alternative. Or does it not?
Juho Vuori
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Hi all In an attempt to order my digital life by using Zope (Plone, actually) for all info I need and generate. As a frequent traveller, I have a notebook on which I run Zope, as well as a server machine. Because I need to take my info with me on the notebook when I do not have an Internet connection to my server I need to synchronise the two ZODBs. Can this be done? Or would this make a good feature request? ;-) Thanks for your help Andre meyer@acm.org -- Dr. Andre P. Meyer TNO TPD / Knowledge and Information Systems Visiting address: Stieltjesweg 1, Delft Postal address: P.O. Box 155, 2600 AD Delft, The Netherlands T +31 15 2692166 / M +31 6 11061077 / F +31 15 2692111 mailto:meyer@tpd.tno.nl / http://www.tpd.tno.nl/ mailto:meyer@acm.org / http://home.hccnet.nl/a.meyer/
On Tue, Jan 20, 2004 at 04:36:57PM +0100, Andre Meyer wrote:
Hi all
In an attempt to order my digital life by using Zope (Plone, actually) for all info I need and generate. As a frequent traveller, I have a notebook on which I run Zope, as well as a server machine.
Because I need to take my info with me on the notebook when I do not have an Internet connection to my server I need to synchronise the two ZODBs. Can this be done? Or would this make a good feature request? ;-)
If nobody else is working on the server while you are away, you can simply copy the entire database (by default, var/Data.fs) from the server to notebook before you leave, and copy it in the reverse direction when you get back. If you need to merge changes in both directions, there's no fully automatic system that I know of. ZSyncer will probably be useful... http://zsyncer.sf.net -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's THE SONIQ PHILANTHROPIST! (random hero from isometric.spaceninja.com)
If you are on OSX or Unix you can use rsync, so you don't have to copy the entire thing (it will only copy the changes). I use this to back up my Data.fs nightly to other drives and it works like a charm. Jake -- http://www.ZopeZone.com Paul Winkler said:
On Tue, Jan 20, 2004 at 04:36:57PM +0100, Andre Meyer wrote:
Hi all
In an attempt to order my digital life by using Zope (Plone, actually) for all info I need and generate. As a frequent traveller, I have a notebook on which I run Zope, as well as a server machine.
Because I need to take my info with me on the notebook when I do not have an Internet connection to my server I need to synchronise the two ZODBs. Can this be done? Or would this make a good feature request? ;-)
If nobody else is working on the server while you are away, you can simply copy the entire database (by default, var/Data.fs) from the server to notebook before you leave, and copy it in the reverse direction when you get back.
If you need to merge changes in both directions, there's no fully automatic system that I know of. ZSyncer will probably be useful... http://zsyncer.sf.net
--
Paul Winkler http://www.slinkp.com Look! Up in the sky! It's THE SONIQ PHILANTHROPIST! (random hero from isometric.spaceninja.com)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Juho Vuori wrote:
A newbieish question. I thought <dtml-var foo> and <dtml-var expr="foo()"> were the same thing. Seems they are not: Depending on the way foo is called something differs in the environment they run in.
Given the following situation:
I have an dtml-method foo = <dtml-var bar>
And dtml-method bar <dtml-var baz>
Plus a third method baz <p>Pazaa!</p>
Now viewing foo does exactly what you think it does: It goes calls bar which calls baz which returns the text <p>Pazaa!</p>
Now change the first method foo: <dtml-var expr="bar()">
And you'll get KeyError: baz
Does somebody understand what is going on?
My real-world situation is that I need to specify a path, which as far as I know forces me to use the expr="Pat.to.my.bar()" alternative. Or does it not?
Part of the DTML magic is that it needs a namespace given to it. When you use the first syntax, this is done automagically. When you use the second, no magic is done, so you're required to do it. Take a look for documents explaining how to call DTML from ZPT for examples. (This sort of confusion is one of many reasons I will usually recommend against DTML.) You can get a specific object's namespace on the top using dtml-with, btw. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
J. Cameron Cooper wrote:
Part of the DTML magic is that it needs a namespace given to it. When you use the first syntax, this is done automagically. When you use the second, no magic is done, so you're required to do it. Take a look for documents explaining how to call DTML from ZPT for examples. (This sort of confusion is one of many reasons I will usually recommend against DTML.)
Hehe, me too, go for ZPT from the start every time ;-) cheers, Chris
participants (7)
-
Andre Meyer -
Chris Withers -
J. Cameron Cooper -
Jake (aka BZ) -
Juho Vuori -
Paul Winkler -
Small Business Services