grabbing the url query string
I would like to have a url that I can use to address a zope object where I grab the query string and 'do something with it'. The issue is I want to be able to do this for any/all zope objects. For example lets say I have a zpt in my site called http://mzope.edu/zopeobject I would like to be able to do http://mzope.edu/zopeobject?id=129292 and have a way to capture the value of 'id'.. The use case I have in mind is a set of emails where I hand out a url to a page in a zope or plone zie that has a key or tag on it like the id above. In one set of email id=abc, in another set the id=xyz. I want to track 'clicks' based on which mailing generated the click. But I want to be able to apply the 'method' to any/all zope objects. Does this make sense? -- David Bear phone: 602-496-0424 fax: 602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 "Beware the IP portfolio, everyone will be suspect of trespassing"
--On 9. Juli 2007 18:05:41 -0700 David Bear <David.Bear@asu.edu> wrote:
I would like to have a url that I can use to address a zope object where I grab the query string and 'do something with it'. The issue is I want to be able to do this for any/all zope objects. For example lets say I have a zpt in my site called http://mzope.edu/zopeobject
I would like to be able to do http://mzope.edu/zopeobject?id=129292
and have a way to capture the value of 'id'..
The use case I have in mind is a set of emails where I hand out a url to a page in a zope or plone zie that has a key or tag on it like the id above. In one set of email id=abc, in another set the id=xyz. I want to track 'clicks' based on which mailing generated the click. But I want to be able to apply the 'method' to any/all zope objects.
Everything is stored within the REQUEST object (REQUEST.id in your case). Please check with "The Zope Book" (this is one of the most basic functionalities of Zope). -aj
----- Original Message ----- From: "David Bear" <David.Bear@asu.edu> To: "zope" <Zope@zope.org> Sent: Monday, July 09, 2007 9:05 PM Subject: [Zope] grabbing the url query string
I would like to have a url that I can use to address a zope object where I grab the query string and 'do something with it'. The issue is I want to be able to do this for any/all zope objects. For example lets say I have a zpt in my site called http://mzope.edu/zopeobject
I would like to be able to do http://mzope.edu/zopeobject?id=129292
and have a way to capture the value of 'id'..
The use case I have in mind is a set of emails where I hand out a url to a page in a zope or plone zie that has a key or tag on it like the id above. In one set of email id=abc, in another set the id=xyz. I want to track 'clicks' based on which mailing generated the click. But I want to be able to apply the 'method' to any/all zope objects.
I have heard of a pre-traversal hook called "before_publishing_traverse", but I have never investigated or tried it (others may have more info on this) - I think it is used in skinning and may be adaptable to your needs. Using 'known' methods I would approach your use case (if I understand it correctly) as follows: 1) set up a python script 'cntr', which tracks your clicks and then does a redirect to the required zope object 2) set up your urls like: http://mzope.edu/cntr/129292/targetfolder/targetobject In the 'cntr' python script you will have access to a list variable, in REQUEST, called "traverse_subpath". Each element of the traverse_subpath list will be one of the url parameters that follows 'cntr' in the url. For example, for the url above: traverse_subpath = ['129292', 'targetfolder', 'targetobject'] It will be a trivial exercise to extract the counter 'id' (first element of list) and then reconstruct a url, for the redirect, from the remaining list elements. hth Jonathan
participants (3)
-
Andreas Jung -
David Bear -
Jonathan