Re: [Zope] working with urls
Nicholas Wieland wrote at 2005-7-25 15:39 +0200: >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 Have a look at "PythonScript"s "traverse_subpath" binding. I would expect that you find a description in the Zope Book (2.7 edition, online). -- Dieter ___ Zope maillist - Zope@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 )
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 [EMAIL PROTECTED], Peter Bengtsson <[EMAIL PROTECTED]> 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 ___ Zope maillist - Zope@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 )
Re: [Zope] working with urls
Because it's a bit ugly - my url will grow a lot, because I have to include the variable name. It's also really simple to make the product generate a PDF if the user know the ref_date and code, without playing with variable names. Obviously if it's not possible I will generate a normal querystring, no problem at all, I'm just curious to know if it's possible to have urls like in ruby on rails :) TIA, ngwJonathan <[EMAIL PROTECTED]> ha scritto: Why don't you identify the variable data portion of the urls you are building as standard http-type arguments: eg. http://www.myweb.com/amethod?var1=val1&var2=val2... This way var1, var2 etc will be accessible to your method as entries in REQUEST. Jonathan - Original Message - From: Nicholas Wieland To: zope@zope.org Sent: Monday, July 25, 2005 9:39 AM Subject: [Zope] working with urls First of all thanks everyone for the help, I've resolved my problems one after the other thanks to the suggestions I've found here. 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. Is it possible inside Zope without mod_rewriting and similar stuff ? I don't like querystring, the resulting url would be too long and difficult to paste. I know that this is not the way Zope works ... TIA, ngw Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3 ___Zope maillist - Zope@zope.orghttp://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 ) Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3___ Zope maillist - Zope@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 )
Re: [Zope] working with urls
Why don't you identify the variable data portion of the urls you are building as standard http-type arguments: eg. http://www.myweb.com/amethod?var1=val1&var2=val2... This way var1, var2 etc will be accessible to your method as entries in REQUEST. Jonathan - Original Message - From: Nicholas Wieland To: zope@zope.org Sent: Monday, July 25, 2005 9:39 AM Subject: [Zope] working with urls First of all thanks everyone for the help, I've resolved my problems one after the other thanks to the suggestions I've found here. 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. Is it possible inside Zope without mod_rewriting and similar stuff ? I don't like querystring, the resulting url would be too long and difficult to paste. I know that this is not the way Zope works ... TIA, ngw Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3 ___Zope maillist - Zope@zope.orghttp://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 ) ___ Zope maillist - Zope@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 )