Evert Rol <[EMAIL PROTECTED]> writes:
> I was afraid so. I guess somewhere along the line, things have to be
> decoded anyway.
> I have little say over the ID, so I cannot really prevent a slash or %
> 2f occurring (or simply tell how many there'll be).
> For the moment, I took Ron's idea and use map.connect
> (':controller/:action/*id'), but I guess that may prevent some Routes
> functionality (eg like an automatic 404).
I ran into the same problem when trying to match 5 or so
slash-separated values -- some of them could contain slashes. I
finally used the route map to decode the values that would never have
slashes, and put the ones that might into the QUERY_STRING part then
pulled them off in my controller. Like so:
def search(self, expires, checksum):
"""
The messy fac, sev, text are in the querystring to preserve slashes.
"""
from paste.request import parse_querystring
try:
qs = dict(parse_querystring(request.environ))
c.fac = qs['fac']
c.sev = qs['sev']
c.text = qs['text']
except KeyError, e:
warning("search: could not get fac,sev,text from qs=%s (%s)" % (qs,
e))
c.error = "Sorry, could not determine facility, severity, and error
message text from URL."
return render_response(self.template)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---