Great! Thanks! I should be able to give this a try shortly. I use it a lot so that functionality was sorely missed. Allen -----Original Message----- From: Christian Tismer [mailto:ctismer@gmx.net] Sent: Wednesday, July 18, 2001 12:20 PM To: Schmidt, Allen J. Cc: 'zope@zope.org'; Tim Cook Subject: Re: [Zope] ODBC Test Queries "Schmidt, Allen J." wrote:
Not sure how many use the feature but I do all the time. The ODBC Test window.
Recently, not sure when it started, but when I execute a generic select statement, and the are more that 25 results, I get the link at the bottom for the next batch. However, the query' is not getting passed to this link and so I do not actually get the next set. Instead I get an error stating the obvious - 'query' was not defined.
I had a closer look at it. The problem exists with Gadfly as well. It only occourse when you use a database connection and test it with some test SQL. This is a limitation in Connection.py . If you use ZSQLmethods, you will not have this problem. Reason: ZSQLmethods carry their SQL template as a property. A simple connection does not, since it has no permanent property for the (temporary) SQL string. The alternative would be to pass the SQL string as a parameter to the "next 50" link. This isn't very nice since this is a GET request, which is limited in size. But for not too large test SQL input, it will work. Here the patch: Edit the file "Connection.py" (dir D:\Zope\lib\python\Shared\DC\ZRDB) Locate line 189 ff in manage_test: if REQUEST is None: return result #return unadulterated result objects Add the following code snippet: #CT: passign the query parameter to the "next 50 results" link import urllib REQUEST.environ["QUERY_STRING"] = "query=" + urllib.quote(query) That's all, folks. The query will now be rendered as part of the URL, and it works. ciao - chris -- Christian Tismer :^) <mailto:tismer@tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net/ 14163 Berlin : PGP key -> http://wwwkeys.pgp.net/ PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com/
"Schmidt, Allen J." wrote:
Great! Thanks!
I should be able to give this a try shortly. I use it a lot so that functionality was sorely missed.
Well, the code change was five minutes. But guess how long I waded through code, tried to figure out *which* part of the REQUEST is used to format an URL part, and where and how this occours at all? It took me a whole night, since I have a very limited idea of Zope. The REQUEST variable is a quite ambiguous object - there is the same stuff in different places. Variables occour in the "form" attribute, but the sequence-query doesn't use it - it wants to use the query string directly. If it would use the form attribute, everything would have worked by magic. But things like this will be much faster next time - ly y'rs - chris p.s.: Design question: The QUERY_STRING attribute of the environment is one thing. It is quite near to the (not really relevant) fact that we use a GET in this context. The form attribute is a generalization, since there is always a form attribute, regardless whether we chosed to use a GET or a POST method. The real point is about what part of the REQUEST is used to carry state information. I think there is a missing concept for this: You can see this if you do testing of a Z SQL method. Have a look at the "ext" URL: The URL carries useless information, since the value of the submit button is caried around, which nobody really needs. I'd like to introduce a "state" attribute for REQUEST: This should be the set of attributes intended to be carried around between stateful queries, nothing more and nothing less. Maybe I will submit a proposal to zope-dev. cheers again - chris -- Christian Tismer :^) <mailto:tismer@tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net/ 14163 Berlin : PGP key -> http://wwwkeys.pgp.net/ PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com/
participants (2)
-
Christian Tismer -
Schmidt, Allen J.