The Doctor What writes:
.... <dtml-sqlgroup where> <dtml-sqltest ID type=int optional> <dtml-and> "val_Protocol"."ID" = "URL"."val_ProtocolID" </dtml-sqlgroup>
If I make that: <dtml-sqlgroup where> "URL"."ID" = <dtml-var ID sql_quote> <dtml-and> "val_Protocol"."ID" = "URL"."val_ProtocolID" </dtml-sqlgroup>
Then ID cannot be optional. I can't use this object as a 'list all' solution. Isn't that the whole point of the dtml-sqltest tag? Then, you wrap it into an "dtml-if":
<dtml-sqlgroup where> <dtml-if ID> "URL"."ID" = <dtml-var ID sql_quote> </dtml-if> <dtml-and> .... Dieter
* Dieter Maurer (dieter@handshake.de) [010309 14:39]:
Then, you wrap it into an "dtml-if":
<dtml-sqlgroup where> <dtml-if ID> "URL"."ID" = <dtml-var ID sql_quote> </dtml-if> <dtml-and> ....
Would that colapse the dtml-and? Ciao! -- Didn't your teacher ever tell you? Sharing is communisim and is unamerican. At least thats what mine told me, he only had one eye, and his name changed to "prime time" betweeen the hours of 7 and 11 --Cybercuzco on Slashdot The Doctor What: A Holtje Production http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
Having decided I'm going against the flow, I nuked the casesensitivity. 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 = <dtml-sqlvar category_id type="int" optional> AND xref_URL_val_Category.URLID = URL.ID </dtml-if> <dtml-and> <dtml-if url_id> URL.ID = <dtml-sqlvar url_id type="int" optional> </dtml-if> <dtml-and> <dtml-if protocol_id> URL.val_ProtocolID = <dtml-sqlvar protocol_id type="int" optional> </dtml-if> <dtml-and> val_Protocol.ID = 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="url_name(url_id=None)"> </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! -- 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
* The Doctor What (docwhat@gerf.org) [010311 23:00]:
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.
OK, I figured it out (after searching around with google for a while): Apparently, I can specify arguments to ZSQL Methods as if they are python functions/methods with the added plus of adding type checking. So I changed my params from: url_id category_id protocol_id to: url_id:int=0 category_id:int=0 protocol_id:int=0 If this is in the ZopeBook, I completly missed it. Ciao! -- "Smoke me a Kipper, I'll be back for breakfast" --"Ace" Rimmer (Red Dwarf) The Doctor What: Second Baseman http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
Setting the arguments doesn't fix everything: ZSQL Object 'tmp' Arguments: ID:int=2 ------------------------- select * from url <dtml-sqlgroup where> <dtml-if expr="ID != 2"> ID = '<dtml-var ID>' </dtml-if> </dtml-sqlgroup> ------------------------- The normal case, of setting ID = to something other than 2 works great. URL: http://docwhat.gerf.org:9673/pi/links/tmp/manage_test?ID%3Aint=2&SUBMIT=Subm... Produces: select * from url URL: http://docwhat.gerf.org:9673/pi/links/tmp/manage_test?SUBMIT=Submit+Query Produces: select * from url where ID = '2' Which is WRONG! It's brimming over with wrongability. What is going wrong. I just want to be able to have default variables that cause large portions of the ZSQL query to remove themselves. Waaah....I'm tired. Ciao! -- Computers are not intelligent. They only think they are. The Doctor What: A really hip dude http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
* The Doctor What (docwhat@gerf.org) [010311 23:59]:
Setting the arguments doesn't fix everything: ZSQL Object 'tmp' Arguments: ID:int=2 ------------------------- select * from url <dtml-sqlgroup where> <dtml-if expr="ID != 2"> ID = '<dtml-var ID>' </dtml-if> </dtml-sqlgroup> -------------------------
The normal case, of setting ID = to something other than 2 works great.
URL: http://docwhat.gerf.org:9673/pi/links/tmp/manage_test?ID%3Aint=2&SUBMIT=Subm... Produces: select * from url
URL: http://docwhat.gerf.org:9673/pi/links/tmp/manage_test?SUBMIT=Submit+Query Produces: select * from url where ID = '2'
Which is WRONG! It's brimming over with wrongability.
What is going wrong. I just want to be able to have default variables that cause large portions of the ZSQL query to remove themselves.
Waaah....I'm tired.
Ciao!
This is a ZOPE bug, isn't it. I bet the ID is stowed someplace that DTML-IF can't reach it, but DTML-VAR can....or somesuch. I'm using Debian UNSTABLE's Zope (2.3.0-3) on POTATO. I'm going to bed. Ciao! -- LEGO DEFINITION 105 BURP: Big Ugly Rock Peice The Doctor What: Guru to the Gods http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
The Doctor What writes:
... Z SQL method ... Arguments: ID:int=2 ------------------------- ... <dtml-if expr="ID != 2"> ... </dtml-if> </dtml-sqlgroup> -------------------------
.... URL: http://docwhat.gerf.org:9673/pi/links/tmp/manage_test?SUBMIT=Submit+Query Produces: select * from url ....
Which is WRONG! It's brimming over with wrongability. This is a ZOPE bug, isn't it. I bet the ID is stowed someplace that DTML-IF can't reach it, but DTML-VAR can....or somesuch. It is a bug, but you will loose you bet.
The bug is that Zope does not apply the type conversion to the default value. Put it into the collector. Dieter
* Dieter Maurer (dieter@handshake.de) [010313 12:09]:
The bug is that Zope does not apply the type conversion to the default value.
Put it into the collector.
Razafraz. I put it in the collector, it is bug #2053. But I forgot to put your sentence above into it. I cannot figure out how to append something to the bug, so maybe you have that ability? Ciao! -- Like the ski resort of girls looking for husbands and husbands looking for girls, the situation is not as symmetrical as it might seem. The Doctor What: <fill in the blank> http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
participants (2)
-
Dieter Maurer -
The Doctor What