RE: [Zope] Inserting values into db - problems
Wayne -- Please cc the zope@zope.org when you respond to me; other people may find this help useful.
<dtml-raise type="client"> </dtml-raise> insert into y8 values( now(), now(), <dtml-sqlvar client 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"> )
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.
Don't understand the question about an if block? What are you talking about?
On the zope site, the example I saw is as follows :
<dtml-if "balance >= debit_amount"> <dtml-call "debitAccount(account)"> Your account, <dtml-var account>, has been debited. <dtml-else> <dtml-raise type="Insufficient funds"> There is not enough money in account <dtml-account> to cover the requested debit amount.<p> </dtml-raise> </dtml-if>
So I am trying to work out if I have to test the value and then do a dtml-raise if it fails, inside a dtml-if block as the example does...
Normally, dtml-raise would be used to raise an error manually if something bad happens, so, yes, it would often be used with dtml-if. However, you can use it yourself for debugging purposes, and it's quite useful like this.
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
participants (2)
-
Joel Burton -
Wayne Pascoe