Hi! I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. Here are a couple of examples: <!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p> <!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p> Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.) Mike
Hi Mike, try: < p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/> -steve On Friday, August 3, 2001, at 05:19 PM, Mike Murphy wrote:
Hi! I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. Here are a couple of examples:
<!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p>
<!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p>
Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.)
Mike
_______________________________________________ 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 )
Steve, I still got a TALES error in trying what you suggested: <p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/> But it is a different error than before... a "guarded getitem" error... Mike ... File /opt/Zope/lib/python/Products/PageTemplates/ZRPythonExpr.py, line 121, in __call__ (Info: root.games.hangman.index_html(root.games.hangman)) File Python expression "root.games.hangman.index_html(root.games.hangman)", line 2, in f (Object: guarded_getattr) File /opt/Zope-2.4.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 194, in __call__ (Object: index_html) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 544, in __call__ (Object: index_html) File /opt/Zope-2.4.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 187, in __call__ (Object: standard_html_header) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 544, in __call__ (Object: standard_html_header) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_With.py, line 148, in render (Object: images) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_Var.py, line 280, in render (Object: PARENTS[-1].applications.guestbook.entryForm) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 230, in eval (Object: PARENTS[-1].applications.guestbook.entryForm) (Info: PARENTS) File <string>, line 2, in f (Object: guarded_getitem) TALESError: (see above) ----- Original Message ----- From: "Steve Spicklemire" <steve@spvi.com> To: "Mike Murphy" <mike@flipper.eskimo.net> Cc: "Steve Spicklemire" <steve@spvi.com>; <zope@zope.org> Sent: Friday, August 03, 2001 4:13 PM Subject: Re: [Zope] Problem: Calling DTML Method from ZPT
Hi Mike,
try:
< p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/>
-steve
On Friday, August 3, 2001, at 05:19 PM, Mike Murphy wrote:
Hi! I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. Here are a couple of examples:
<!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p>
<!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p>
Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.)
Mike
_______________________________________________ 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 )
Hi Mike, Something in your standard_html_header having to do with a guestbook is raising an exception. You've left out the actual error type from the error page, so it's sorta hard to tell from there. I see a couple of problems.. apparantly your index_html wants to display a whole page... this will be bogus in a <p /> tag. Also.. it's hard to tell what contextual information your index_html is going to need.. you man need to pass in additional arguments. Can you share a bit about index_html? In any case, you might replace it with some simpler stuff to make sure it's getting called correctly. 'nuther layer in the dang onion ;->, -steve Mike Murphy wrote:
Steve,
I still got a TALES error in trying what you suggested:
<p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/>
But it is a different error than before... a "guarded getitem" error...
Mike
... File /opt/Zope/lib/python/Products/PageTemplates/ZRPythonExpr.py, line 121, in __call__ (Info: root.games.hangman.index_html(root.games.hangman)) File Python expression "root.games.hangman.index_html(root.games.hangman)", line 2, in f (Object: guarded_getattr) File /opt/Zope-2.4.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 194, in __call__ (Object: index_html) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 544, in __call__ (Object: index_html) File /opt/Zope-2.4.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 187, in __call__ (Object: standard_html_header) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 544, in __call__ (Object: standard_html_header) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_With.py, line 148, in render (Object: images) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_Var.py, line 280, in render (Object: PARENTS[-1].applications.guestbook.entryForm) File /opt/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 230, in eval (Object: PARENTS[-1].applications.guestbook.entryForm) (Info: PARENTS) File <string>, line 2, in f (Object: guarded_getitem) TALESError: (see above)
----- Original Message ----- From: "Steve Spicklemire" <steve@spvi.com> To: "Mike Murphy" <mike@flipper.eskimo.net> Cc: "Steve Spicklemire" <steve@spvi.com>; <zope@zope.org> Sent: Friday, August 03, 2001 4:13 PM Subject: Re: [Zope] Problem: Calling DTML Method from ZPT
Hi Mike,
try:
< p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/>
-steve
On Friday, August 3, 2001, at 05:19 PM, Mike Murphy wrote:
Hi! I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. Here are a couple of examples:
<!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p>
<!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p>
Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.)
Mike
_______________________________________________ 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 )
Mike Murphy writes:
I still got a TALES error in trying what you suggested:
<p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/> ... (Object: PARENTS[-1].applications.guestbook.entryForm) (Info: PARENTS) File <string>, line 2, in f (Object: guarded_getitem) You need to pass "request" as second argument!
<p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman,request)"/> Dieter
Hi Dieter, Mike, Hmm... well technically I think it's optional: def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" it depends on whether something you're using *in* the DTML needs something that can only be gotten from the REQUEST. Since Mike didn't say anything about the DTML he was calling... it could be either way. However.. you are right Dieter.. that putting in the REQUEST shouldn't(/couldn't?) hurt.. but my point would be that it's also not necessary, unless of course it's necessary. ;-) It's also true that unless the <p ... /> tag was the only thing in the ZPT object, then his traceback shows that the resulting HTML would've been invalid anyway, since the DTML he was calling was somehow invoking standard_html_header which normally starts out with <html>.... take care, -steve On Saturday, August 4, 2001, at 04:36 PM, Dieter Maurer wrote:
Mike Murphy writes:
I still got a TALES error in trying what you suggested:
<p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman)"/> ... (Object: PARENTS[-1].applications.guestbook.entryForm) (Info: PARENTS) File <string>, line 2, in f (Object: guarded_getitem) You need to pass "request" as second argument!
<p tal:replace="structure python:root.games.hangman.index_html(root.games.hangman,request)"/>
Dieter
Mike Murphy writes:
I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. It is possible (we do it with great success).
Here are a couple of examples:
<!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p> You forget to call the DTML object. Use: <p tal:replace="python:root.games.hangman.index_html(here,request)"></p>
<!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p> This should work.
The "TALES" error (last PageTemplate release!) should tell you (and maybe us) more about the problem cause.
Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.) You information is a bit scarce.
Dieter
The suggestion to add 'request' to the DTML call did the trick! The following is what works <p tal:replace="python:root.games.hangman.index_html(root.games.hangman, request)"/> Thanks to all who replied with suggestions--hope this helps someone else. Mike (BTW, what probably complicated matters is that my zope is probably not installed quite right... I think I have a permissions problem somewhere... it gives me a _v_blocks attribute error when I try to view SQL methods, etc..) ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Mike Murphy" <mike@flipper.eskimo.net> Cc: <zope@zope.org> Sent: Friday, August 03, 2001 6:21 PM Subject: Re: [Zope] Problem: Calling DTML Method from ZPT
Mike Murphy writes:
I am having problems executing a DTML Method from a ZPT. I have been unable to find documentation regarding whether this is even possible or not. It is possible (we do it with great success).
Here are a couple of examples:
<!-- With this snippet, I get the DTML unrendered: --> <p tal:replace="python:root.games.hangman.index_html"></p> You forget to call the DTML object. Use: <p tal:replace="python:root.games.hangman.index_html(here,request)"></p>
<!-- With this snippet, I get a TALES error and a big stack trace: --> <p tal:replace="root/games/hangman/index_html"></p> This should work.
The "TALES" error (last PageTemplate release!) should tell you (and maybe us) more about the problem cause.
Anybody have any ideas what it is that I am doing wrong? I like ZPT conceptually, and ran into this snag while converting some of my DTML. (I am running Zope 2.4.0 with the latest hotfix.) You information is a bit scarce.
Dieter
_______________________________________________ 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 )
participants (3)
-
Dieter Maurer -
Mike Murphy -
Steve Spicklemire