alviandk / django-voting

Automatically exported from code.google.com/p/django-voting
0 stars 0 forks source link

Unicode causes problems #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

the unicode branch merged in trunk for django causes problems in voting:
The usage of get(**lookup_kwargs) (in views.py) does not work correctly

lookup_kwargs['%s__exact' % slug_field] = slug
causes the problem here ... because of the unicode strings in django it
will translate in something like:
{u'slug__exact': u'eatthis'} which definitely won't work with ** in the
get() function because unicode strings are not allowed as key names. What
we need here should look like this:
{'slug__exact': u'eatthis'}

So ..... the quick fix would be:
lookup_kwargs['%s__exact' % str(slug_field)] = slug
but it does not look very nice ....
The long term alternative would be to wait for Python 3000 ... but this
might take a bit longer ;-)

Cheers
        Alex

Original issue reported on code.google.com by Alexande...@gmail.com on 10 Jul 2007 at 1:38

GoogleCodeExporter commented 8 years ago
Hi

what is the currnet status of this?

(I have a unicode aware web-app, and consider to use django-voting)

regards
Valery

Original comment by khame...@gmail.com on 4 Nov 2008 at 3:27

GoogleCodeExporter commented 8 years ago
I don't see how this is a problem - slug_field is an argument which you pass in 
when
you're configuring or calling the view function yourself, so just don't pass in 
a
unicode string when you're doing so. Django won't be stepping in and 
automatically be
converting it to unicode at any stage.

Original comment by jonathan.buchanan on 6 Nov 2008 at 11:16