Discussion:
custom filter in mounting a url
suman jakkula
2014-10-16 13:37:46 UTC
Permalink
Hello,


How do I add a custom filter in mounting a URI path using Bottle instance?

app = default_app()
app.mount('/tenant/<:re:Foo([0-9]+)>/foos', app=foos_api())
app.mount('/tenant/<:re:Bar[0-9]+)>/bars', app=bars_api())

Instead of the regex, I would like to add a custom filter in mount uri like
below:

app.mount('/tenant/<token:myFilter>/foos', app=foos_api())

But bottle did not allow it. How do I add a custom filter to validate and
raise a custom HttpResponse while mounting a Uri?


-

Suman
--
--
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
2014-10-21 19:16:24 UTC
Permalink
Yes that is possible and documented here:
http://bottlepy.org/docs/dev/routing.html#wildcard-filters
Post by suman jakkula
Hello,
How do I add a custom filter in mounting a URI path using Bottle instance?
|app= default_app()
app.mount('/tenant/<:re:Foo([0-9]+)>/foos', app=foos_api())
app.mount('/tenant/<:re:Bar[0-9]+)>/bars', app=bars_api())
|
Instead of the regex, I would like to add a custom filter in mount uri
|app.mount('/tenant/<token:myFilter>/foos', app=foos_api())
|
But bottle did not allow it. How do I add a custom filter to validate
and raise a custom HttpResponse while mounting a Uri?
-
Suman
--
--
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...