[Zope] ZSQL argument passing

Bryan C. Andregg bryan.andregg@duke.edu
Wed, 13 Mar 2002 09:33:37 -0500


--rwgQ89ZNnFUwFHTC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

While iterating over the results of a ZSQL method, which includes a fieldna=
me
"userid" I call another ZSQL method like so,

  passwdGetUser(username=3D_.SecurityGetUser)

  passwdGetUser takes two optional arguments "username" and "userid",

    select * from passwd
    <dtml-sqlgroup where>
      <dtml-sqltest userid type=3Dint optional>
    <dtml-and>
      <dtml-sqltest username type=3Dnb optional>
    </dtml-sqlgroup>

When called like above,

  passwdGetUser(username=3D_.SecurityGetUser)

I found that some times this wouldn't return anything. Investigation turned=
 up
that since "userid" is set in the outer iteration it gets passed to
passwdGetUser even though it's not explicitly in the statement. I solve this
problem by calling,

  passwdGetUser(username=3D_.SecurityGetUser, userid=3D'')

To me, this is non-obvious and I'm wondering why this is happening, and if
it's meant to.
--=20
Bryan C. Andregg		Duke University Medical Center
 Programmer			Dept. of Anesthesiology
 e <bryan.andregg@duke.edu>
 p +1 919 684 6201

--rwgQ89ZNnFUwFHTC
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8j2NBj9pElyS/cakRAq1CAJ48e95OW5Lv0/vTy/jMGYJNA3+DZQCfTD+A
E9l8j9trUPZ/P16dB34h/GE=
=oi+3
-----END PGP SIGNATURE-----

--rwgQ89ZNnFUwFHTC--