Hi all, Part of a site I'm working on needs to be able to insert job numbers into a database. I'm using PostgreSQL as the backend and psycopg as the connecter. I am able to select values from the database without problems. However, I can insert anything. I have a dtml document that prompts for values called addJobNumber. This has an action of another dtml document named commitJob. commitJob has a dtml-call to insert_job which is a Z SQL method. The Z SQL method is as follows: insert into y8 values( now(), now(), <dtml-sqlvar client type="string"> <dtml-sqlvar description type="string">, <dtml-sqlvar product type="string">, nextval('y8_number'), <dtml-sqlvar description type="string">, <dtml-sqlvar client_job_number type="string">, <dtml-sqlvar client_po_number type="string">, <dtml-sqlvar client_contact type="string">, <dtml-sqlvar tech_contact type="string">, <dtml-sqlvar job_close_date type="string"> ) When I try this, I get an error saying : Missing input variable, client Traceback (innermost last): File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 114, in publish File /usr/local/zope/lib/python/Zope/__init__.py, line 158, in zpublisher_exception_hook (Object: localhost) File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 98, in publish File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: commitJob) File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: commitJob) File /usr/local/zope/lib/python/OFS/DTMLDocument.py, line 127, in __call__ (Object: commitJob) File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 473, in __call__ (Object: commitJob) File /usr/local/zope/lib/python/Shared/DC/ZRDB/DA.py, line 414, in __call__ (Object: insert_job) File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 473, in __call__ (Object: <string>) File /usr/local/zope/lib/python/Shared/DC/ZRDB/sqlvar.py, line 99, in render (Object: client) Missing Input: (see above) If I remove the dtml-call in the commitJob document and just print each value using <dtml-var client><br><br> All values print as expected (as entered on the previous form) Is there anything obvious that I'm missing here that could be causing this problem ? TIA, -- Wayne Pascoe <wayne.pascoe@ehsrealtime.com> The price of freedom is eternal vigilance - Thomas Jefferson
On 13/3/02 9:55 am, "Wayne Pascoe" <wayne.pascoe@ehsrealtime.com> wrote:
Hi all,
Part of a site I'm working on needs to be able to insert job numbers into a database. I'm using PostgreSQL as the backend and psycopg as the connecter. I am able to select values from the database without problems. However, I can insert anything.
Hi all, I found the problem with this part... I didn't have the fields I was expected listed in the arguments field. I now have client clientContact clientPoNumber clientJobNumber description product techContact JobCloseDate In the arguments field and the content of the method is as follows : 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"> ) When I call the Z SQL method now, I get an error saying : Zope Error Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: __call__() got multiple values for keyword argument 'client' The URL at this point is http://localhost/commitJob?client=1&product=2&description=3&clientJobNumber= 4&clientPoNumber=5&clientContact=6&techContact=7&jobCloseDate=8 I can find no duplication of client in here. How many characters does zope allow as the field name ? Is this a problem with clientJobNumber being seen as client for some reason and if so, how do I fix this ? The form that ends up here is as follows : <div align="center"> <table width="80%" border="0" cellspacing="0" cellpadding="3"> <form action="commitJob"> <tr> <dtml-let e="_.DateTime()"> <td>Date: <font color="#777777"><dtml-var expr="e.strftime('%Y%m%d')"></font></td> </dtml-let> <td>Client: <input type="text" name="client"></td> </tr> <tr> <td>Product: <input type="text" name="product"></td> <td>Description: <input type="text" name="description"></td> </tr> <tr> <td>Client Job Number: <input type="text" name="clientJobNumber"></td> <td>Client P.O. Number: <input type="text" name="clientPoNumber"></td> </tr> <tr> <td>Client Contact: <input type="text" name="clientContact"></td> <td>Tech Contact: <input type="text" name="techContact"></td> </tr> <tr> <td colspan="2">Job Close Date (YYYY/MM/DD): <input type="text" name="jobCloseDate"></td> </tr> <tr> <td><input type="submit" value="Submit"> <td><input type="reset" value="Reset"> </tr> </form> </table> TIA, -- Wayne Pascoe <wayne.pascoe@ehsrealtime.com> The price of freedom is eternal vigilance - Thomas Jefferson
Hmm. I don't see anything wrong. Try putting a <dtml-raise> in your method with that will show you the value of "client". It might be obvious once you see what it thinks client is. BTW, small point: now() is deprecated syntax in PostgreSQL. In the future, you want to use CURRENT_TIMESTAMP (not a function, no parens), which is the SQL standard compliant. Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton Knowledge Management & Technology Consultant
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Wayne Pascoe Sent: Wednesday, March 13, 2002 5:54 AM To: zope@zope.org Subject: Re: [Zope] Inserting values into db - problems
On 13/3/02 9:55 am, "Wayne Pascoe" <wayne.pascoe@ehsrealtime.com> wrote:
Hi all,
Part of a site I'm working on needs to be able to insert job numbers into a database. I'm using PostgreSQL as the backend and psycopg as the connecter. I am able to select values from the database without problems. However, I can insert anything.
Hi all,
I found the problem with this part... I didn't have the fields I was expected listed in the arguments field.
I now have client clientContact clientPoNumber clientJobNumber description product techContact JobCloseDate In the arguments field and the content of the method is as follows :
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"> )
When I call the Z SQL method now, I get an error saying : Zope Error
Zope has encountered an error while publishing this resource.
Error Type: TypeError Error Value: __call__() got multiple values for keyword argument 'client'
The URL at this point is http://localhost/commitJob?client=1&product=2&description=3&client JobNumber= 4&clientPoNumber=5&clientContact=6&techContact=7&jobCloseDate=8 I can find no duplication of client in here. How many characters does zope allow as the field name ?
Is this a problem with clientJobNumber being seen as client for some reason and if so, how do I fix this ?
The form that ends up here is as follows :
<div align="center"> <table width="80%" border="0" cellspacing="0" cellpadding="3"> <form action="commitJob">
<tr> <dtml-let e="_.DateTime()"> <td>Date: <font color="#777777"><dtml-var expr="e.strftime('%Y%m%d')"></font></td> </dtml-let> <td>Client: <input type="text" name="client"></td> </tr>
<tr> <td>Product: <input type="text" name="product"></td> <td>Description: <input type="text" name="description"></td> </tr>
<tr> <td>Client Job Number: <input type="text" name="clientJobNumber"></td> <td>Client P.O. Number: <input type="text" name="clientPoNumber"></td> </tr>
<tr> <td>Client Contact: <input type="text" name="clientContact"></td> <td>Tech Contact: <input type="text" name="techContact"></td> </tr>
<tr> <td colspan="2">Job Close Date (YYYY/MM/DD): <input type="text" name="jobCloseDate"></td> </tr>
<tr> <td><input type="submit" value="Submit"> <td><input type="reset" value="Reset"> </tr>
</form>
</table>
TIA,
-- Wayne Pascoe <wayne.pascoe@ehsrealtime.com>
The price of freedom is eternal vigilance - Thomas Jefferson
_______________________________________________ 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 )
participants (2)
-
Joel Burton -
Wayne Pascoe