Hello.
I'm trying to "enhance" an existing application
which uses CP 2.2.1 to
my liking.
For this, it would be great, if URLs always and ever ended
with a /.
Reading the
CP 2.2.1 documentation on cherrypy.org, I find:
| Yes, you read that third line correctly:
root.admin.search.index
| will be called whether or not the URI has a trailing
slash.
Actually,
| that isn't quite true; CherryPy will answer a request for
"/admin/
search"
| (without the slash) with an HTTP Redirect response.
This only seems to be true for URLs which have a direct
association
from
URL -> handler. Or rather, it seems to be not true for
something which
accepts positional parameters.
As an example, I "enhanced" the
tut04_complex_site.py with:
class Admin:
def user(self, *args):
if not args:
raise cherrypy.HTTPError(400, "A user id
was expected but
not supplied.")
#id = args.pop(0)
if args and args[0] == 'schedule':
return self.schedule(id)
return "You asked for user '%s'" % args
user.exposed = True
cherrypy.root.admin = Admin()
(Complete source at http://askwar.pasteb
in.ca/484981).
When I now call http://localhost/adm
in/user/4711, I get the output of
"You asked for user 4711". Fine.
According to the doc., I would have expected, that CP would
have sent
a redirect to http://localhost/a
dmin/user/4711/. This did not happen,
though.
What do I have to do, so that redirects ARE sent?
Thanks,
Alexander
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|