Hi there- I need to include a forward slash in a URL (ex: myapp.com/search/AC/DC where "AC/DC" is the search term). This of course wreaks havoc with my routing. Does anyone have a suggestion how to handle this? Thanks, Dan
Hi, On 11/29/10 12:03 AM, Dan Ross wrote: > I need to include a forward slash in a URL (ex: myapp.com/search/AC/DC > where "AC/DC" is the search term). Generally I wouldn't do that, for search and other user input go with /search?query=AC/DC for the simple reason that even with slashes allowed, there will still be user input that can't be represented in the URL. However if you want to do it, declare it as /search/<path:query> Regards, Armin
Thanks for the answer Armin.
What does the route look like then? Currently I have
@app.route("/search/<type>/<search_item>")
def search(type, search_item):
code
On 11/28/10 5:14 PM, Armin Ronacher wrote:
> Hi,
>
> On 11/29/10 12:03 AM, Dan Ross wrote:
>> I need to include a forward slash in a URL (ex: myapp.com/search/AC/DC
>> where "AC/DC" is the search term).
> Generally I wouldn't do that, for search and other user input go with
> /search?query=AC/DC for the simple reason that even with slashes
> allowed, there will still be user input that can't be represented in the
> URL. However if you want to do it, declare it as /search/<path:query>
>
>
> Regards,
> Armin
Nevermind. I finally found it in the docs. I knew I saw it in there somewhere. On 11/28/10 7:07 PM, Dan Ross wrote: > Thanks for the answer Armin. > > What does the route look like then? Currently I have > @app.route("/search/<type>/<search_item>") > def search(type, search_item): > code > > > > On 11/28/10 5:14 PM, Armin Ronacher wrote: >> Hi, >> >> On 11/29/10 12:03 AM, Dan Ross wrote: >>> I need to include a forward slash in a URL (ex: myapp.com/search/AC/DC >>> where "AC/DC" is the search term). >> Generally I wouldn't do that, for search and other user input go with >> /search?query=AC/DC for the simple reason that even with slashes >> allowed, there will still be user input that can't be represented in the >> URL. However if you want to do it, declare it as /search/<path:query> >> >> >> Regards, >> Armin