Discussion:
[bottlepy] How to accept strings with special characters in them?
p***@gmail.com
2018-09-13 02:39:12 UTC
Permalink
I use the following bottle code.

@route('/hello/<name>')
def index(name):
print name
return template('<b>Hello {{name}}</b>!', name=name)

run(host='localhost', port=8080)


Neither of the following wget command will return a name with slash in it.
Does anybody know how to allow it take strings with special characters like
slashes? Thanks.

$ wget -qO- http://localhost:8080/hello/abc/x
$ wget -qO- http://localhost:8080/hello/abc%2Fx
--
--
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.
peb aryan
2018-09-24 09:38:01 UTC
Permalink
use :path filter

from tutorial https://bottlepy.org/docs/dev/tutorial.html :

:path matches all characters including the slash character in a non-greedy
way and can be used to match more than one path segment.

usage example in static file routing

@route('/static/<path:path>')
def callback(path):
return static_file(path, ...)
Post by p***@gmail.com
I use the following bottle code.
@route('/hello/<name>')
print name
return template('<b>Hello {{name}}</b>!', name=name)
run(host='localhost', port=8080)
Neither of the following wget command will return a name with slash in
it. Does anybody know how to allow it take strings with special characters
like slashes? Thanks.
Post by p***@gmail.com
$ wget -qO- http://localhost:8080/hello/abc/x
$ wget -qO- http://localhost:8080/hello/abc%2Fx
--
--
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
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.
Marcel Hellkamp
2018-09-24 10:08:29 UTC
Permalink
That said, the paths /hello/abc/x and /hello/abc%2Fx are equivalent and
indistinguishable on server-side.
Post by peb aryan
use :path filter
:path matches all characters including the slash character in a
non-greedy way and can be used to match more than one path segment.
usage example in static file routing
@route('/static/<path:path>')
    return static_file(path, ...)
Post by p***@gmail.com
I use the following bottle code.
@route('/hello/<name>')
    print name
    return template('<b>Hello {{name}}</b>!', name=name)
run(host='localhost', port=8080)
Neither of the following wget command will return a name with slash
in it. Does anybody know how to allow it take strings with special
characters like slashes? Thanks.
Post by p***@gmail.com
$ wget -qO- http://localhost:8080/hello/abc/x
$ wget -qO- http://localhost:8080/hello/abc%2Fx
--
--
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.
Post by p***@gmail.com
To unsubscribe from this group and stop receiving emails from it,
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
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.
Loading...