iraycd
iraycd

Reputation: 892

Parenthesis URL dispatcher Django?

I have a parenthesis in my url :

Ex: http://en.wikipedia.org/wiki/Sacramentum_(oath)

Where The URL has parenthesis.

Django give """Page not found (404)"""

Any idea how to solve this problem ????

Upvotes: 1

Views: 821

Answers (1)

Ghopper21
Ghopper21

Reputation: 10477

I'm guessing you have a URL pattern in urls.py that looks something like this (to use your example):

urlpatterns = patterns('',
    url(r'^wiki/Sacramentum_(oath)/', my_view),
)

This won't match, because parentheses have a special meaning in regular expressions. You need to escape them with backslashes:

urlpatterns = patterns('',
    url(r'^wiki/Sacramentum_\(oath\)/', my_view),
)

Upvotes: 1

Related Questions