[Zope] Inserting values into db - problems

Wayne Pascoe wayne.pascoe@ehsrealtime.com
Wed, 13 Mar 2002 14:47:24 +0000


On 13/3/02 2:27 pm, "Joel Burton" <joel@joelburton.com> wrote:

> Wayne --
> 
> Please cc the zope@zope.org when you respond to me; other people may find
> this help useful.

Apologies for that breach. I normally remember. Brain must be switched off
:(

> make that
> 
> <dtml-raise type="client">
> <dtml-var client>
> </dtml-raise>
> 
> So that we see the actual output of the client variable.
> 
> One small idea: it's possible that "client" is a meaningful word to Zope.
> Might want to change the parameter & dtml-sqlvar to "theclient" or somesuch
> and see what happens.

Hmmm. Now I'm preplexed. Changing client to clientName fixes the problem
when I do a test without the dtml-raise part. Data is then inserted into the
database. If I have the dtml-raise chunk in as follows :

insert into y8 values(
CURRENT_TIMESTAMP, 
CURRENT_TIMESTAMP,
<dtml-raise type="client">
<dtml-var client>
</dtml-raise>
<dtml-sqlvar clientName type="string">,
<dtml-sqlvar product type="string">,
nextval('y8_number'),
<dtml-sqlvar description type="string">,
<dtml-sqlvar clientJobNumber type="string">,
<dtml-sqlvar clientPoNumber type="string">,
<dtml-sqlvar clientContact type="string">,
<dtml-sqlvar techContact type="string">,
<dtml-sqlvar jobCloseDate type="string">
)

I get 

 Z SQL Method at  /localhost/insert_job
Help!
Error, client: Invalid Error Value SQL used:

Could not render the query template!

I've tried having the dtml-raise lines before the insert as well, with the
same results.

Removing the dtml-raise lines makes this work through the test tab. I still
have problems using it from the form though. I get

Zope Error

Zope has encountered an error while publishing this resource.

Error Type: KeyError
Error Value: client

both with and without the dtml-raise lines present. The URL at this point is
http://localhost/commitJob?clientName=1&product=2&description=3&clientJobNum
ber=4&clientPoNumber=5&clientContact=6&techContact=7&jobCloseDate=20020331
Which has no occurance of client that I can see.

So it does appear that using the name client was part of the problem as this
fixes the error in a test tab, but it does not help when calling from a
handcrafted URL... :(

-- 
Wayne Pascoe <wayne.pascoe@ehsrealtime.com>

The price of freedom is eternal vigilance
   - Thomas Jefferson