[Zope] confused about optional args to ZSQL methods

Lutz Steinborn l.steinborn@4c-ag.de
Thu, 5 Dec 2002 06:55:04 +0100


Good morning,

I'am not shure but I have in my mind that Zope didn't like identifiers wi=
th
the string id in it in ZSQL.
Try worker_foo.

Have a nice day.

Lutz Steinborn

On Wed, 4 Dec 2002 23:10:41 -0600
Skip Montanaro <skip@pobox.com> wrote:

> I think I may have encountered this problem before and asked about it.=20
> If so, any solutions offered at that time escape me now.  I have this
> ZSQL method (get_workorder):
>=20
>     <params>id
>     worker_id
>     end_date</params>
>     select * from work_order
>       <dtml-sqlgroup where>
>         <dtml-sqltest name=3Did op=3Deq type=3Dint optional>
>       <dtml-and>
>         <dtml-sqltest name=3Dworker_id op=3Deq type=3Dint optional>
>       <dtml-and>
>         <dtml-sqltest name=3Dend_date op=3Dge type=3Dstring optional>
>       </dtml-sqlgroup>
>     ;
>=20
> In a Python script I want to call it like so:
>=20
>     workorders =3D context.sql.get_workorder(worker_id=3Dworker_id,
>                                            end_date=3D'2003-04-23')
>=20
> that is, omit the presumably optional id parameter.  However, when the
> Python script is run, the ZSQL method complains "Invalid integer value
> for id".  I also tried these forms:
>=20
>     workorders =3D context.sql.get_workorder(**{'worker_id': worker_id,
>                                               'end_date': '2003-04-23'}=
)
>=20
>     workorders =3D context.sql.get_workorder(**{'id': None,
>                                               'worker_id': worker_id,
>                                               'end_date': '2003-04-23'}=
)
>=20
>     workorders =3D context.sql.get_workorder(id=3DNone,
>                                            worker_id=3Dworker_id,
>                                            end_date=3D'2003-04-23')
>=20
>=20
> without success.  The first form gave the same error as above.  The oth=
er
> two gave "object can't be converted to int".
>=20
> How do I arrange things so I can call get_workorder without passing
> the id parameter?
>=20
> Thx,
>=20
> --=20
> Skip Montanaro - skip@pobox.com
> http://www.mojam.com/
> http://www.musi-cal.com/
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


--=20
Lutz Steinborn                   mailto:l.steinborn@4c-ag.de
4c AG                            Tel +49 6092 999592
Stefan-George-Ring 22-24         Fax +49 89 99341 399
81929 M=FCnchen                    http://www.4c-shopping.de