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

2000-07-05 Thread asjf11

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']"
(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  -  [EMAIL PROTECTED]
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 )




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

2000-07-05 Thread jpenny

On Wed, Jul 05, 2000 at 01:31:56PM -0800, [EMAIL PROTECTED] 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  -  [EMAIL PROTECTED]
 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 )
 

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




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

2000-07-05 Thread Ron Bickers

Unless I'm overlooking something here, you can just use the form variables
(e.g., dtml-var formVarName), whether POST or GET, in the ZSQL Method
itself.  You'll need to include the variable names in the arguments list of
the ZSQL Method, but that's it.

ZSQL Methods are explained (fairly well in my opinion) in the Z SQL Methods
User's Guide at http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.html

Note that if you're using Zope 2.1.6 (vs. 2.1.4 or 2.2b3) you may have
problems with this, since versions after 2.1.4 broke ZSQLMethods with regard
to names and in which order they are looked up.  This made me jump from
2.1.4 straight to the 2.2 beta series, where this is fixed.

___

Ron Bickers
Logic Etc, Inc.
[EMAIL PROTECTED]


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
 [EMAIL PROTECTED]
 Sent: Wednesday, July 05, 2000 5:32 PM
 To: [EMAIL PROTECTED]
 Subject: [Zope] How do I merge form  URL vars into sql easily


 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']"
 (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  -  [EMAIL PROTECTED]
 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 )




___
Zope maillist  -  [EMAIL PROTECTED]
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 )