Re: Utf-8 encoding errors with unicode in urlpatterns - Django 1.3

2011-04-14 Thread Leszek Piątek
from django.conf.urls.defaults import patterns, include, url
from views import test

urlpatterns = patterns('',
url(ur'(?Pdom|działka|kamienica|biuro)/(?Pwynajem|
sprzedaż)/$', test, name='home'),
)

+

http://localhost.com:8000/dzia%25C5%2582ka/sprzeda%25C5%25BC/

I thought it would be more convinient to run whole app, but You are
right - You don't know what kind of code I've put there...

PS: Thanks for feedback!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Utf-8 encoding errors with unicode in urlpatterns - Django 1.3

2011-04-14 Thread Daniel Roseman
On Wednesday, April 13, 2011 9:31:27 PM UTC+1, Leszek Piątek wrote:
>
> Hi! 
>
> I've recently came across problem in django. According to 
> documentation I should be able to use unicode inside urlpatterns - but 
> something is wrong I guess. 
>
> When URL exists I got error displayed on dev server console (no sigh 
> of problem), but IF URL DOESN'T exists error is printed out on webpage 
> without giving any 404 exception. If I got DEBUG=off it raises 500 
> error. Can someone confirm it's not proper bahaviour and it is a bug 
> which should be filled in to django bugtrack? I haven't tested it on 
> Django 1.2x yet... 
>
> I've prepared sample app http://www.sendspace.com/file/dw0s93 
>
> No-one wants to install your whole app. Please can you just post the 
urls.py file.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Utf-8 encoding errors with unicode in urlpatterns - Django 1.3

2011-04-14 Thread Leszek Piątek
Hi!

I've recently came across problem in django. According to
documentation I should be able to use unicode inside urlpatterns - but
something is wrong I guess.

When URL exists I got error displayed on dev server console (no sigh
of problem), but IF URL DOESN'T exists error is printed out on webpage
without giving any 404 exception. If I got DEBUG=off it raises 500
error. Can someone confirm it's not proper bahaviour and it is a bug
which should be filled in to django bugtrack? I haven't tested it on
Django 1.2x yet...

I've prepared sample app http://www.sendspace.com/file/dw0s93

1.) python manage.py runserver
2.) browse to http://localhost.com:8000/dzia%C5%82ka/sprzeda%C5%BC/

Error traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/core/servers/basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/contrib/staticfiles/handlers.py", line 68, in __call__
return self.application(environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/core/handlers/wsgi.py", line 273, in __call__
response = self.get_response(request)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/core/handlers/base.py", line 146, in get_response
response = debug.technical_404_response(request, e)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/views/debug.py", line 296, in technical_404_response
'reason': smart_unicode(exception, errors='replace'),
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/utils/encoding.py", line 39, in smart_unicode
return force_unicode(s, encoding, strings_only, errors)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/
django/utils/encoding.py", line 71, in force_unicode
s = unicode(s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u017c' in
position 106: ordinal not in range(128)

PS: When I comment out line around 294 of django.views.debug file

 #'reason': smart_unicode(exception, errors='replace'),

everthing is OK. I don't know for what this variable is used as it is
simple Exception... probably it's wrongly set in static handler (new
in 1.3) but it is to deep inside of django for me to track it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.