[Zope] Passing lists in a get request (ZCatalog Search)

Dieter Maurer dieter@handshake.de
Sun, 3 Dec 2000 13:54:22 +0100 (CET)


Darin Lee writes:
 > ... 
 > but when I try to sort the column (with a ?sort_on=index "get" request), the selected criteria are forgotten and the entire result set is returned sorted. 
You add also the search criteria to your URL?
I.e. you use

     your_method?sort_on=theme&theme=xxx&theme=yyy

If you simply append "?sort_on=theme" to

     your_method?theme=xxx&theme=xxx

Then, you would have two '?parameter' sections. Only the last
would be taken. The first would be part of the path which should
give you a NotFound Exception. But maybe, there is a bug somewhere.

You could also use a <dtml-call "REQUEST.set('sort_on','theme')">
in "your_method" before the "dtml-in", in case the sort order
is fixed.


 > for example, one of my search criteria is "theme" - there are four possible  (Air, Land, Water, and Waste). 
 > 
 > the request would look like:
 > search?meta_type=Publication&theme=Air&theme=Land&theme=Water
 > 
 > I can't figure out how to pass a list in the get request.
That is a good approach. If the same parameter is repeated,
Zope will bind a list of all values to the parameter name.

If you would like to be sure to get a list (or no value at all),
you can use "theme:list". This will ensure, that a list is
bound even if there is only a single "theme" parameter.

This is irrelevant for your application, however.

 > .... difficult to build long list "param=v1&param=v2&...." ....
Usually, the browser builds such URL for you (out of a form).
E.g., if you use a multiple select box or several check boxes
with the same name, the browser will construct corresponding
"param=v" for each selected/checked value.

 > .... length limitation with get ....
HTTP 1.1 (and I think HTTP 1.0) has removed the length restriction.
At least Zope/Zserver will not impose an unreasonalble limit.


Someone else suggested to use a post (rather than get) request.
In general, I would warn you against this solution.
It will break the "dtml-in" batch support.



Dieter