[Zope] multiple optional args to zsql method?

Skip Montanaro skip@pobox.com
Mon, 25 Nov 2002 13:02:02 -0600


I have this ZSQL method:

    <params>
    id
    zope_username
    </params>
    select * from worker
      <dtml-sqlgroup where>
        <dtml-sqltest name="id" op="eq" type="int" optional>
      <dtml-or>
        <dtml-sqltest name="zope_username" op="eq" type="string" optional>
      </dtml-sqlgroup>
    ;

When I test it but give no parameters it executes this SQL:

    select * from worker
      where
    zope_username = ''
    ;

Since neither id nor zope_username were given shouldn't it have executed

    select * from worker
    ;

?  I also tried using <dtml-and> instead of <dtml-or>.  Same-o, Same-o.

In addition, if I call it as

    context.sql.get_worker(zope_username=user.getUserName())

from a Python script, it complains "Invalid integer value for id".

I'm flummoxed.

-- 
Skip Montanaro - skip@pobox.com
http://www.mojam.com/
http://www.musi-cal.com/