passing a parameter - namespace and dtml-with
I tried using orig_title in the format <dtml-var orig_title> in the called dtml-method (category_results) and I get a zope error which I don't understand: *Error Type: TypeError Error Value: sequence index must be integer* When I call it in the orignal page which I want the title for it works fine. John Eikenberry jae-zope at kavi.com <http://kavi.com> Mon Aug 29 16:05:37 EDT 2005 - Previous message: [Zope] passing a parameter - namespace and dtml-with <http://mail.zope.org/pipermail/zope/2005-August/161244.html> - Next message: [Zope] zope 2.8 command line tracebacks <http://mail.zope.org/pipermail/zope/2005-August/161248.html> - *Messages sorted by:* [ date ]<http://mail.zope.org/pipermail/zope/2005-August/date.html#161245> [ thread ]<http://mail.zope.org/pipermail/zope/2005-August/thread.html#161245> [ subject ]<http://mail.zope.org/pipermail/zope/2005-August/subject.html#161245> [ author ]<http://mail.zope.org/pipermail/zope/2005-August/author.html#161245> ------------------------------ Sean Kelley wrote:
* I am trying to pass the title of a page to a dtml method which is in another *>* folder named links. If I pass the actual title like below everything works. *>* However, when I try to pass the value of the current title to *>* category_results using various other methods it does not.*>* What is the syntax so that I can pass the current value of <dtml-var title> *>* to the method? Would the dtml-with block change the namespace it pulls the *>* title variable from to the context of the method category_results in the *>* links folder?* Yes.
Here's a quick hack that will work. <dtml-call "REQUEST.set('orig_title',this().title)"> <dtml-with links> <dtml-var "catagory_results(_.None,REQUEST.get('orig_title'))"> </dtml-with>
* <dtml-with links>*>* <dtml-comment>This line works</dtml-comment>*>* <dtml-var "category_results(_.None, _, title1='Hannoverian Stallions Lauries *>* Crusador ')">*>* </dtml-with>*
Better <dtml-let orig_title="'Hannoverian Stallions Lauries Crusador ' "> <dtml-with links> <dtml-var "catagory_results(_, _.None, title1=orig_title)"> </dtml-with> </dml-let> Use dtml-let and notice the extra _ in the parameters. I doubt that DTML methods accept plain arguments except self, REQUEST and RESPONSE. All other things must be passed with keyword arguments. On 8/30/05, Sean Kelley <kelleyfarm@gmail.com> wrote:
I tried using orig_title in the format <dtml-var orig_title> in the called dtml-method (category_results) and I get a zope error which I don't understand: Error Type: TypeError Error Value: sequence index must be integer
When I call it in the orignal page which I want the title for it works fine.
John Eikenberry jae-zope at kavi.com Mon Aug 29 16:05:37 EDT 2005
Previous message: [Zope] passing a parameter - namespace and dtml-with Next message: [Zope] zope 2.8 command line tracebacks Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ Sean Kelley wrote:
I am trying to pass the title of a page to a dtml method which is in another folder named links. If I pass the actual title like below everything works. However, when I try to pass the value of the current title to category_results using various other methods it does not. What is the syntax so that I can pass the current value of <dtml-var title> to the method? Would the dtml-with block change the namespace it pulls the title variable from to the context of the method category_results in the links folder?
Yes.
Here's a quick hack that will work.
<dtml-call "REQUEST.set('orig_title',this().title)"> <dtml-with links> <dtml-var "catagory_results(_.None,REQUEST.get('orig_title'))"> </dtml-with>
<dtml-with links> <dtml-comment>This line works</dtml-comment> <dtml-var "category_results(_.None, _, title1='Hannoverian Stallions Lauries Crusador ')"> </dtml-with>
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
<comment mode="off-topic"> Wow, I had forgotten how incredibly ugly DTML can be. That just looks wrong, like you stumbled on your keyboard. Maybe I should go hang out on the perl lists and build up some tolerance for "interesting" syntax. :^) </comment> On Tue, 30 Aug 2005 01:08:52 +0200, Peter Bengtsson <peterbe@gmail.com> wrote:
Better
<dtml-let orig_title="'Hannoverian Stallions Lauries Crusador ' "> <dtml-with links> <dtml-var "catagory_results(_, _.None, title1=orig_title)"> </dtml-with> </dml-let>
Use dtml-let and notice the extra _ in the parameters. I doubt that DTML methods accept plain arguments except self, REQUEST and RESPONSE. All other things must be passed with keyword arguments.
On 8/30/05, Sean Kelley <kelleyfarm@gmail.com> wrote:
I tried using orig_title in the format <dtml-var orig_title> in the called dtml-method (category_results) and I get a zope error which I don't understand: Error Type: TypeError Error Value: sequence index must be integer
When I call it in the orignal page which I want the title for it works fine.
John Eikenberry jae-zope at kavi.com Mon Aug 29 16:05:37 EDT 2005
Previous message: [Zope] passing a parameter - namespace and dtml-with Next message: [Zope] zope 2.8 command line tracebacks Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ Sean Kelley wrote:
I am trying to pass the title of a page to a dtml method which is in another folder named links. If I pass the actual title like below everything works. However, when I try to pass the value of the current title to category_results using various other methods it does not. What is the syntax so that I can pass the current value of <dtml-var title> to the method? Would the dtml-with block change the namespace it pulls the title variable from to the context of the method category_results in the links folder?
Yes.
Here's a quick hack that will work.
<dtml-call "REQUEST.set('orig_title',this().title)"> <dtml-with links> <dtml-var "catagory_results(_.None,REQUEST.get('orig_title'))"> </dtml-with>
<dtml-with links> <dtml-comment>This line works</dtml-comment> <dtml-var "category_results(_.None, _, title1='Hannoverian Stallions Lauries Crusador ')"> </dtml-with>
_______________________________________________ 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 )
-- _____________________________________________________________________ Alexander Limi · Chief Architect · Plone Solutions · Norway Consulting · Training · Development · http://www.plonesolutions.com _____________________________________________________________________ Plone Co-Founder · http://plone.org · Connecting Content Plone Foundation · http://plone.org/foundation · Protecting Plone
Alexander Limi wrote:
<comment mode="off-topic"> Wow, I had forgotten how incredibly ugly DTML can be. That just looks wrong, like you stumbled on your keyboard. Maybe I should go hang out on the perl lists and build up some tolerance for "interesting" syntax. :^) </comment>
Yes. DTML is ugly, which is why its bee superseded by page templates. ZPTs are much nicer and just about the best way to do html-embedded display code that I've seen. At least compared to the alternatives. -- John Eikenberry [jae@kavi.com] ______________________________________________________________ "A society that will trade a little liberty for a little order will deserve neither and lose both." --B. Franklin
Only problem is I am using a dtml-in inside the category_results method which calls a sql method and it now gives me an error: <dtml-in expr="category_match1(_)" size=50 start=query_start> ... </dtml-in> Perhaps its not finding the title1 value I am trying to pass to it? *Error Type: NameError Error Value: global name 'category_match1' is not defined* On 8/29/05, Peter Bengtsson <peterbe@gmail.com> wrote:
Better
<dtml-let orig_title="'Hannoverian Stallions Lauries Crusador ' "> <dtml-with links> <dtml-var "catagory_results(_, _.None, title1=orig_title)"> </dtml-with> </dml-let>
Use dtml-let and notice the extra _ in the parameters. I doubt that DTML methods accept plain arguments except self, REQUEST and RESPONSE. All other things must be passed with keyword arguments.
On 8/30/05, Sean Kelley <kelleyfarm@gmail.com> wrote:
I tried using orig_title in the format <dtml-var orig_title> in the called dtml-method (category_results) and I get a zope error which I don't understand: Error Type: TypeError Error Value: sequence index must be integer
When I call it in the orignal page which I want the title for it works fine.
John Eikenberry jae-zope at kavi.com <http://kavi.com> Mon Aug 29 16:05:37 EDT 2005
Previous message: [Zope] passing a parameter - namespace and dtml-with Next message: [Zope] zope 2.8 command line tracebacks Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ Sean Kelley wrote:
I am trying to pass the title of a page to a dtml method which is in another folder named links. If I pass the actual title like below everything works. However, when I try to pass the value of the current title to category_results using various other methods it does not. What is the syntax so that I can pass the current value of <dtml-var title> to the method? Would the dtml-with block change the namespace it pulls the title variable from to the context of the method category_results in the links folder?
Yes.
Here's a quick hack that will work.
<dtml-call "REQUEST.set('orig_title',this().title)"> <dtml-with links> <dtml-var "catagory_results(_.None,REQUEST.get('orig_title'))"> </dtml-with>
<dtml-with links> <dtml-comment>This line works</dtml-comment> <dtml-var "category_results(_.None, _, title1='Hannoverian Stallions Lauries Crusador ')"> </dtml-with>
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com <http://www.fry-it.com> home www.peterbe.com <http://www.peterbe.com> hobby www.issuetrackerproduct.com <http://www.issuetrackerproduct.com>
-- Sean Kelley
Sean Kelley wrote:
Only problem is I am using a dtml-in inside the category_results method which calls a sql method and it now gives me an error: <dtml-in expr="category_match1(_)" size=50 start=query_start> ... </dtml-in> Perhaps its not finding the title1 value I am trying to pass to it?
Honestly, thes emore explicit nature of ZPT would leave you with a LOT less trouble here. It's not that often you find me agreeing with Alex Limi ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
On 8/30/05, Sean Kelley <kelleyfarm@gmail.com> wrote:
Only problem is I am using a dtml-in inside the category_results method which calls a sql method and it now gives me an error: <dtml-in expr="category_match1(_)" size=50 start=query_start> ... </dtml-in>
Perhaps its not finding the title1 value I am trying to pass to it?
That's got nothing to do with 'title1'. The error tells you that category_match1 doesn't exist. If you think it should exist, it's because you haven't called the "parenting" dtml method correctly. I.e. with the wrong namespace. Why can't you just use Page Templates?
Error Type: NameError Error Value: global name 'category_match1' is not defined
On 8/29/05, Peter Bengtsson <peterbe@gmail.com> wrote:
Better
<dtml-let orig_title="'Hannoverian Stallions Lauries Crusador ' "> <dtml-with links> <dtml-var "catagory_results(_, _.None, title1=orig_title)"> </dtml-with> </dml-let>
Use dtml-let and notice the extra _ in the parameters. I doubt that DTML methods accept plain arguments except self, REQUEST and RESPONSE. All other things must be passed with keyword arguments.
On 8/30/05, Sean Kelley <kelleyfarm@gmail.com> wrote:
I tried using orig_title in the format <dtml-var orig_title> in the called dtml-method (category_results) and I get a zope error which I don't understand: Error Type: TypeError Error Value: sequence index must be integer
When I call it in the orignal page which I want the title for it works fine.
John Eikenberry jae-zope at kavi.com Mon Aug 29 16:05:37 EDT 2005
Previous message: [Zope] passing a parameter - namespace and dtml-with Next message: [Zope] zope 2.8 command line tracebacks Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ Sean Kelley wrote:
I am trying to pass the title of a page to a dtml method which is in another folder named links. If I pass the actual title like below everything works. However, when I try to pass the value of the current title to category_results using various other methods it does not. What is the syntax so that I can pass the current value of <dtml-var title> to the method? Would the dtml-with block change the namespace it pulls the title variable from to the context of the method category_results in the links folder?
Yes.
Here's a quick hack that will work.
<dtml-call "REQUEST.set('orig_title',this().title)"> <dtml-with links> <dtml-var "catagory_results(_.None,REQUEST.get('orig_title'))"> </dtml-with>
<dtml-with links> <dtml-comment>This line works</dtml-comment> <dtml-var "category_results(_.None, _, title1='Hannoverian Stallions Lauries Crusador ')"> </dtml-with>
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
-- Sean Kelley
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
Peter Bengtsson wrote:
Better
<dtml-let orig_title="'Hannoverian Stallions Lauries Crusador ' "> <dtml-with links> <dtml-var "catagory_results(_, _.None, title1=orig_title)"> </dtml-with> </dml-let>
Use dtml-let and notice the extra _ in the parameters. I doubt that DTML methods accept plain arguments except self, REQUEST and RESPONSE. All other things must be passed with keyword arguments.
Opps. Yes. dtml-let is what you should use. Been awhile since I've done to much with dtml. -- John Eikenberry [jae@kavi.com] ______________________________________________________________ "A society that will trade a little liberty for a little order will deserve neither and lose both." --B. Franklin
participants (5)
-
Alexander Limi -
Chris Withers -
John Eikenberry -
Peter Bengtsson -
Sean Kelley