Re: [Zope] Document parameters as part of a URL
Peter Bengtsson wrote: Well, you could maybe create a new type of DTML Method called Clear DTML Method which would in principle look something like this: from zope.somewhere import DTMLMethod class ClearDTMLMethod(DTMLMethod): meta_type = "Clear " + DTMLMethod.meta_type def __before_publishing_traverse__(...): do your stuff # cross your fingers that it will work But this restricts you to DTML Methods. So if you change to Page Templates one day you'll have to recode the url param stuff. Actually both ZPT and Python Scripts support this kind of thing automatically with the traverse_subpath variable. Anything after the name of the ZPT or PS in the URL gets put as a tuple in that variable. Yet another reason to ditch your suzzy DTM(hel)L ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ 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] Document parameters as part of a URL
Well, you could maybe create a new type of DTML Method called Clear DTML Method which would in principle look something like this: from zope.somewhere import DTMLMethod class ClearDTMLMethod(DTMLMethod): meta_type = "Clear " + DTMLMethod.meta_type def __before_publishing_traverse__(...): do your stuff # cross your fingers that it will work But this restricts you to DTML Methods. So if you change to Page Templates one day you'll have to recode the url param stuff. On 6/7/06, Andrew Hedges <[EMAIL PROTECTED]> wrote: Peter, That definitely looks promising. I've tried a couple of ways, but I can't make it so this applies to all DTML Methods. Any ideas? -Andrew On Jun 7, 2006, at 6/7/2006 4:10 PMMDT, Peter Bengtsson wrote: > I much prefer to use __before_publishing_traverse__. > Eg. > > class MyProduct(Something): > def __before_publishing_traverse__(self, object, REQUEST): >""" sort things out before publising object """ >stack = REQUEST['TraversalRequestNameStack'] >if len(stack)==2 and stack[0]=='members' and stack > [1].isdigit(): >REQUEST.set('member_id', stack[1]) >stack.remove(stack[1]) > > That's my opinion. -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.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] Document parameters as part of a URL
Peter, That definitely looks promising. I've tried a couple of ways, but I can't make it so this applies to all DTML Methods. Any ideas? -Andrew On Jun 7, 2006, at 6/7/2006 4:10 PMMDT, Peter Bengtsson wrote: I much prefer to use __before_publishing_traverse__. Eg. class MyProduct(Something): def __before_publishing_traverse__(self, object, REQUEST): """ sort things out before publising object """ stack = REQUEST['TraversalRequestNameStack'] if len(stack)==2 and stack[0]=='members' and stack [1].isdigit(): REQUEST.set('member_id', stack[1]) stack.remove(stack[1]) That's my opinion. ___ 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] Document parameters as part of a URL
I much prefer to use __before_publishing_traverse__. Eg. class MyProduct(Something): def __before_publishing_traverse__(self, object, REQUEST): """ sort things out before publising object """ stack = REQUEST['TraversalRequestNameStack'] if len(stack)==2 and stack[0]=='members' and stack[1].isdigit(): REQUEST.set('member_id', stack[1]) stack.remove(stack[1]) That's my opinion. On 6/7/06, Andrew Hedges <[EMAIL PROTECTED]> wrote: Just curious what people think of the technique described here: http://www.zope.org/Members/petrvanblokland/parameters_in_url This page is a few years old. Is there something built-in to more recent versions of Zope that does this already? If there is, Google has failed me on this one. The context is that I'm working on a DTML (yeah, yeah ... I know) application in Zope 2.9.2 and want to be able to build URLs like this: http://server.domain/members/44 ...where members is a DTML Method and 44 is a user_id I could do things with, like call a ZSQL method. I'd prefer that members is a DTML Method and not a Python script or ZSQL Method. Thanks in advance for any insights! -Andrew - Andrew Hedges, [EMAIL PROTECTED] http://clearwired.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 ) -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.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 )
[Zope] Document parameters as part of a URL
Just curious what people think of the technique described here: http://www.zope.org/Members/petrvanblokland/parameters_in_url This page is a few years old. Is there something built-in to more recent versions of Zope that does this already? If there is, Google has failed me on this one. The context is that I'm working on a DTML (yeah, yeah ... I know) application in Zope 2.9.2 and want to be able to build URLs like this: http://server.domain/members/44 ...where members is a DTML Method and 44 is a user_id I could do things with, like call a ZSQL method. I'd prefer that members is a DTML Method and not a Python script or ZSQL Method. Thanks in advance for any insights! -Andrew - Andrew Hedges, [EMAIL PROTECTED] http://clearwired.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 )