[Zope] Inserting values into db - problems

Joel Burton joel@joelburton.com
Wed, 13 Mar 2002 08:26:24 -0500


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 )
>