urls with utf-8

0 views
Skip to first unread message

visik7

unread,
May 14, 2008, 9:55:20 AM5/14/08
to Django users
I've some data in my model like the name of the object that I would
use to have an url of the object
my clueless users use characters with accents and so I got some
problem to render the template
in short when I use
{% url product-page element.name %}

with the following urlpattern:

url(r'^prodotto/(?P<prod_name>[\w\s]+(?u))/
$','compraofferte.prodotto.views.show_a_product',{},'product-page'),

I got this:

error at /categoria/Idee Regalo/
unknown extension
Request Method: GET
Request URL: http://127.0.0.1:8000/categoria/Idee Regalo/
Exception Type: error
Exception Value: unknown extension
Exception Location: /usr/lib/python2.5/re.py in _compile, line 241
Python Executable: /usr/bin/python
Python Version: 2.5.2
Python Path: ['/home/visi/Devel/django/compraofferte', '/home/visi/
Devel/django/djtrunk', '/usr/lib/python25.zip', '/usr/lib/python2.5',
'/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/
lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/
Numeric', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/
site-packages/gst-0.10', '/var/lib/python-support/python2.5', '/usr/
lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/
python2.5/gtk-2.0', '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-
unicode']

so how I've solved (to be more specific how the kindly guy [530] on
the irc channel solve it) :

adding this urlpattern:
url(r'^prodotto/(?P<prod_name>[\w\s]+)/
$','compraofferte.prodotto.views.show_a_product',{},'product-page-
url'),

and change the template in this way

{% url product-page-url element.name %}

now all works but I really dunno how exactly maybe some problem with
pattern matching of the url tag

question time:
do I need to report a bug or something ?
is there another way to get this without the trick ?


that's all folks
regards
Reply all
Reply to author
Forward
0 new messages