[Zope] How do I merge form & URL vars into sql easily

jpenny@universal-fasteners.com jpenny@universal-fasteners.com
Wed, 5 Jul 2000 18:05:05 -0400


On Wed, Jul 05, 2000 at 01:31:56PM -0800, asjf11@uaa.alaska.edu wrote:
> I am a new user to Zope and I'm trying to pass data that has been 
> entered into a form (either through GET or POST) into another 
> object.  This object calls a z sql method to insert the form data into 
> the database.  So far, the only way I've found to pass data to the 
> sql is to define arguments for it and then, in the dtml-document (or 
> method) use:
> <dtml-call "REQUEST.set['argument','value']">

This is not a cure, but goes a long ways.  If you have ZSql Method
foo, define a dtml-method curryFoo, (or prepareforFoo, or whatever
you like), that has the <dtml-call "REQUEST.set('argument', value)">
statements in it (and nothing else.)

Then your index_html can look like:

...
<dtml-call curryFoo>
<dtml-call foo>
...

This is a reasonable compromise between readability and the
necessity to get the arguments into the current REQUEST.

> (and it took me long enough to figure THAT out, let me tell you)
> The problem is that sucks when there are 30 form varibles that 
> need to be inserted into the database.
> 	I would think that there is some way to let the sql method see 
> these varibles that are defined within my document.  Or loop 
> through all URL or form varibles defined and sets all the vars in 
> request. Something to keep from having to write the above dtml 30 
> times.  Thanks.
> 
> Jake Feasel
> 
> _______________________________________________
> 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 )
>