----- Original Message -----
From: "David Bear" <[EMAIL PROTECTED]>
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
_______________________________________________
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 )