[Zope] Set sort variables with nice url

David Pratt fairwinds at eastlink.ca
Tue Jun 21 13:28:56 EDT 2005


Hi.  I have a nice scheme for my ordering, sorting and batch paging my  
summary columns for objects and sql data but I have been using urls  
like  
employee_edit_form?employee_id=42&start:int=2&sort=employee&reverse:int= 
0 in my lists up till now.

These would be  tal:attributes in my zpt, (a string) for href attribute  
so that you click to edit the appropriate record.  I have hidden fields  
in my edit form that accept the start, sort, and reverse in the request  
so that when the edit is done there is a response.redirect to pass user  
back to the index_html on the proper page in the batch.

I am trying to use the Allow "Simple" Direct Traversal under the  
Advanced tab for ZSQL queries to give me nice urls when passing an id  
parameter to a zsql query with results in an edit form. URLs like:

/employee_by_id/42/employee_edit_form

This works nicely except I need the edit_form to also get my start,  
sort and reverse parameters and I  am hoping there might be some way of  
setting the request in the edit_form so it is possible to use this nice  
zsql traversal feature.  Can someone suggest a solution that would not  
involve direct parameter passing in the url - but in someway of setting  
the request so when the edit_form is called these other parameters are  
available in the request.  Note that start, order and reverse are  
available variables in my index_html and change based on the batch page  
and column heading urls selected.  I have tried using something like  
<tal:define="dummy python:REQUEST.set('tmp_sort', sort) to see if I  
could set tmp_sort in index_form and when edit_form called tmp_sort  
might appear in the request.  Alternatively is there some type of  
javascript that might help with this to either pass the remaining  
parameters or use history in some way?

On a second note, can someone advise me of what I need to place inside  
the <dtml-comment> area in a filesystem zsql query so that it will use  
simple direct traversal.

Many thanks,
David






More information about the Zope mailing list