[Zope] Traversal question
Peter Bengtsson
peterbe at gmail.com
Wed Jun 22 11:27:54 EDT 2005
I have never used traversal into zsql methods simply because I don't
want to expose geeky things like "employee_by_id" to the user. People
should be able to find out what you call your ZSQL methods. My
suggestion is to consider a more controlled solution.
About having request variables in the URL I suggest you download and
study the code of the IssueTrackerProduct. Look for a method called
get_environ and __before_bobobase_traverse__
Then one gets URLs like this:
http://demo.issuetrackerproduct.com/ListIssues/sortorder-urgency/reverse-true
which is translated in get_environ() to
http://demo.issuetrackerproduct.com/ListIssues?sortorder=urgency&reverse=true
On 6/22/05, David Pratt <fairwinds at eastlink.ca> wrote:
> I have gone over the zope book to see what I can do about calling a sql
> with a form and getting three additional parameters in the request and
> am wanting this to get better looking urls that calling the parameters
> directly in the url. I asked a similar question yesterday but perhaps
> it was not clear enough about what asking. It is really a traversal
> question and how to string together a sql query with a zpt form that
> also requires parameters from the request namespace.
>
> I can call my zsql method and then my edit form like this:
> /employee_by_id/employee_id/42/employee_edit_form
>
> or with simple direct traversal on the zsql method:
> /employee_by_id/42/employee_edit_form
>
> Problem is I need three other parameters in the request for my edit
> form to satisfy my sorting so when the edit form returns it is back on
> the same batch page
>
> Parameters passed in traversal go into the request namespace according
> to the zope book so was hoping for something similar to this which
> doesn't work - and I can't see how it could.
>
> /employee_by_id/employee_id/42/employee_edit_form/start/2/sort/
> employee/reverse/0
>
> The zope book examples are with python scripts so am not sure whether
> this is possible with a ZPT that also requires parameters from the
> request or will I need a script to be called in the path somewhere to
> pick up the results of the query and then pass parameters to the form -
> something like:
>
> /employee_by_id/employee_id/42/some_other_script/start/2/sort/employee/
> reverse/0/employee_edit_form
>
> where some_other_script would be a script python. Any hints to help me
> understand what can be done with traversal like this would be
> appreciated since I would rather have nice urls instead of stringing
> parameters directly in the url with all the ?= and &'s.
>
> Regards,
> David
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Zope
mailing list