[Zope] passing a parameter - namespace and dtml-with

Peter Bengtsson peterbe at gmail.com
Mon Aug 29 19:08:52 EDT 2005


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 at 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 at 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


More information about the Zope mailing list