Andy Salnikov
2015-07-01 17:56:34 UTC
Hi, I have an interesting problem when trying to migrate our old code to
bottle.
Basically we have some REST-like interface for one of our services with API
which looks like this (in bottle-route speak):
GET /service/<resource>
GET /service/<resource>/<node:path>
- plus bunch of other methods
This was implemented in pure wsgiref but now I'd like to simplify it a bit
and re-implement with bottle. One major complication here is that we
discovered late in the game that resource name may have embedded slashes in
them. To workaround that we require from client side every resource name
sent to server being quoted including slash character being replaced with
%2F. On server side we parse still quoted path name and extract resource
name from it and unquote it.
This approach does not work well with bottle. First it looks like routing
is using unquoted path which of course confuses our rules. I thought I
would use more generic rule like:
GET/service/<res_and_node:path>
and then parse path myself, but that needs an access to raw unquoted path
as it comes from client and bottle does not seem to provide this facility.
I tried all possible attributes of request instance, but all of them return
path with %2F replaced with slash. It looks like bottle does unquote and
then quote if you want to see the path, which may not be the same as the
original path.
Is there any way in bottle to get access to the path that client sent?
Thanks,
Andy
--
bottle.
Basically we have some REST-like interface for one of our services with API
which looks like this (in bottle-route speak):
GET /service/<resource>
GET /service/<resource>/<node:path>
- plus bunch of other methods
This was implemented in pure wsgiref but now I'd like to simplify it a bit
and re-implement with bottle. One major complication here is that we
discovered late in the game that resource name may have embedded slashes in
them. To workaround that we require from client side every resource name
sent to server being quoted including slash character being replaced with
%2F. On server side we parse still quoted path name and extract resource
name from it and unquote it.
This approach does not work well with bottle. First it looks like routing
is using unquoted path which of course confuses our rules. I thought I
would use more generic rule like:
GET/service/<res_and_node:path>
and then parse path myself, but that needs an access to raw unquoted path
as it comes from client and bottle does not seem to provide this facility.
I tried all possible attributes of request instance, but all of them return
path with %2F replaced with slash. It looks like bottle does unquote and
then quote if you want to see the path, which may not be the same as the
original path.
Is there any way in bottle to get access to the path that client sent?
Thanks,
Andy
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.