[Zope] ooops... ZMYSQL tests fail in the ZMI on batching dynamic
queries
Dennis Allison
allison at shasta.stanford.edu
Sat Oct 8 15:10:58 EDT 2005
Sorry for the long message, but there's a lot of context. I've tried
to factor the problem out and then provide supporting stuff for the
interested. Zope 2.7.6, Python 2.4.1 (Python 2.3.5 behaves in the same
fashion).
In summary, the problem is that a query run as a test from the ZMI of
the form
select * from <dtml-var udb>.tablename
fails on the second batch whereas
select * from foo.tablename
works fine for all batches.
The relevant Zope code distributed with Zope 2.7.6-final had a bug in
it which was discussed earlier on the list. The distributed code did
not terminate batching properly. The problematic code was in
/home/allison/Zope-2.7.6-final/lib/python/Shared/DC/ZRDB/dtml
and the fix was to patch the two link expressions to have a missing
element, that is,
<a href="&dtml-URL;?query_start=&dtml-next-sequence-start-number; \
&query=<dtml-var query url_quote missing="">">
which seemed to resolve the problem.
BUT, there is now a second problem. When the query is dynamic, the
second batch fails on a key error -- for the example above, it would
fail with a
> Z SQL Method at /testfolder/batchcheck External Editor
>
> Help!
> Error, exceptions.KeyError: 'udb' SQL used:
>
> Could not render the query template!
message in the ZMI. However, REQUEST has the proper value for the key
according to the Error Log:
form
query "''"
query_start '21'
other
n_ 5
a_ 0
It's pretty clear that the query is being passed as an empty string due
to the key error. Presumably the query should be rendered and saved in
a persistent manner throughout the batching process. It is not clear
to me where this should be done. Any help in localizing and fixing the
problem would be appreciated.
-d
For the record, the original posting is appended
>From allison at shasta.stanford.edu Sat Oct 8 10:52:32 2005
>Date: Tue, 7 Jun 2005 03:41:21 -0700 (PDT)
>From: Dennis Allison <allison at shasta.stanford.edu>
>To: zope at zope.org
>Subject: Z SQL test in the ZMI aborts on key error
>
>Zope 2.7.6
>Python 2.3.5
>MySQLDA-1.2.1c3
>ZMYSQLDA-2.09b3
>
>
>Site Error
>
>An error was encountered while publishing this resource.
>
>Error Type: KeyError
>Error Value: 'query'
>
>Troubleshooting Suggestions
>
> * This resource may be trying to reference a nonexistent object or
>variable 'query'.
> * The URL may be incorrect.
> * The parameters passed to this resource may be incorrect.
> * A resource that this resource relies on may be encountering an
>error.
>
>
>----------
>Error log:
>
> 2005/06/07 03:33:03.344 GMT-7
>User Name (User Id) allison (allison)
>Request URL http://group1.agilemind.com/Scratch/simpleq/manage_test
>Exception Type KeyError
>Exception Value 'query'
>
>Traceback (innermost last):
>
> * Module ZPublisher.Publish, line 101, in publish
> * Module ZPublisher.mapply, line 88, in mapply
> * Module ZPublisher.Publish, line 39, in call_object
> * Module Shared.DC.ZRDB.DA, line 337, in manage_test
> * Module DocumentTemplate.DT_String, line 474, in __call__
> * Module DocumentTemplate.DT_In, line 602, in renderwb
> * Module DocumentTemplate.DT_Var, line 219, in render
>
>KeyError: 'query'
>
>
>There does not seem to be a bug like this in the collector.
>
>Any help/pointers appreciated
More information about the Zope
mailing list