[Zope] ZSQL Woes....HELP!

The Doctor What docwhat@gerf.org
Sun, 11 Mar 2001 23:01:29 -0600


Having decided I'm going against the flow, I nuked the
case=ADsensitivity.  Now all my fields and tables are lower case.

So based on suggestions, I have changed my ZSQL Method to this:
-------------------------------------------------------------
<params>url_id category_id protocol_id</params>
SELECT URL.ID as url_id,
       val_Protocol.Protocol as url_protocol,
       URL as url_part,
       URL.Name as url_name,
       URL.Description as url_description,
       URL.Created as url_created
FROM URL,
     val_Protocol
     <dtml-if category_id>
        ,xref_URL_val_Category
     </dtml-if>
<dtml-sqlgroup where>
  <dtml-if category_id>
    val_CategoryID =3D <dtml-sqlvar category_id type=3D"int" optional>
    AND
    xref_URL_val_Category.URLID =3D URL.ID
  </dtml-if>
<dtml-and>
  <dtml-if url_id>
    URL.ID =3D <dtml-sqlvar url_id type=3D"int" optional>
  </dtml-if>
<dtml-and>
  <dtml-if protocol_id>
    URL.val_ProtocolID =3D <dtml-sqlvar protocol_id type=3D"int" optional=
>
  </dtml-if>
<dtml-and>
  val_Protocol.ID =3D URL.val_ProtocolID
</dtml-sqlgroup>
-------------------------------------------------------------

Now, this works using the Test link in the manage interface, but no
place else.

If I try it with my viewALL DTML Document:
-------------------------------------------------------------
<dtml-var standard_html_header>

<dtml-in zurl>
<p>
  <dtml-var expr=3D"url_name(url_id=3DNone)">
</p>
</dtml-in

<dtml-var standard_html_footer>
-------------------------------------------------------------

Then I get the error:
Error Type: Bad Request
Error Value: ['url_id', 'category_id', 'protocol_id']

It appears that ZSQL Method isn't recognizing that these variables
are OPTIONAL and are not required.

HELP!  How do I fix this.  Again, a simple example would be great.

Ciao!

--=20
In every non-trivial program there is at least one bug.

The Doctor What: Not that 'who' guy              http://docwhat.gerf.org/
docwhat@gerf.org                                                   KF6VNC