re: [Zope] working with urls
Simplest might be to point a Path Handler (http://www.zope.org/Members/NIP/PathHandler) named 'generate' at your PDF generator script. Also, a Script(Python) 'generate' containing: return traverse_subpath when called http://mysite.com/generate/foo/bar/baz returns: ['foo', 'bar', 'baz'] This could be useful for the URL re-writing you want. Ken --- In zope@yahoogroups.com, Peter Bengtsson <peterbe@g...> wrote:
Now I'm rewriting urls by substituting the href
attribute with custom
data, and everything works fine. What I'd like is having an url like: myproduct/generate/20050301/PG2, and actually that's exactly what I've got. This url will make my app generate a pdf report for the ref_date 2005/03/01 and code PG2 (ref_date and code are internal data). Zope obviously maps the url as an object, but that's not what I want: I want to parse the url and use the ref_date and code data inside a generate method.
You want to write a __bobo_traverse__ method for your class:
def __bobo_traverse__(self, REQUEST, name): # do something with 'name' here. return an_object_that_is_to_be_published
Philipp
I prefer to use __before_publishing_traverse__(self, obj, REQUEST=None)
The IssueTrackerProduct (IssueTracker.py) uses this so that you can URLs like /ListIssues/start-20/reverse-False instead of /ListIssues?start=20&reverse=False but that is just slightly different from what you are after. Good luck
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (1)
-
Ken Ara