I have a model class like this: ---------------------------------------------------------------- class PagesInternal(models.Model): name = models.CharField(primary_key=True, maxlength=150) ... ----------------------------------------------------------------
And my names (the primary keys) contains unterscore, like this: "page_admin.edit_page" I used no ID for the primary key, because i "addressed" the entries about the names. I used the unicode-branch and get a error, if i edit a entry in this model with the django admin panel: ---------------------------------------------------------------- Traceback (most recent call last): File "./django/core/handlers/base.py" in get_response 72. response = middleware_method(request, callback, callback_args, callback_kwargs) File "./PyLucid/middlewares/pagestats.py" in process_view 45. response = view_func(request, *view_args, **view_kwargs) File "./django/contrib/admin/views/decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "./django/views/decorators/cache.py" in _wrapped_view_func 39. response = view_func(request, *args, **kwargs) File "./django/contrib/admin/views/main.py" in change_stage 324. manipulator = model.ChangeManipulator(object_id) File "./django/db/models/manipulators.py" in __init__ 261. self.original_object = self.manager.get(pk=obj_key) File "./django/db/models/manager.py" in get 73. return self.get_query_set().get(*args, **kwargs) File "./django/db/models/query.py" in get 258. obj_list = list(clone) File "./django/db/models/query.py" in __iter__ 111. return iter(self._get_data()) File "./django/db/models/query.py" in _get_data 478. self._result_cache = list(self.iterator()) File "./django/db/models/query.py" in iterator 186. cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ",".join(select) + sql, params) File "./django/db/backends/util.py" in execute 23. 'sql': smart_unicode(sql) % convert_args(params), File "./django/db/backends/util.py" in convert_args 50. return tuple([to_unicode(val) for val in args]) File "./django/db/backends/util.py" in 48. to_unicode = lambda s: force_unicode(s, strings_only=True) File "./django/utils/encoding.py" in force_unicode 42. s = unicode(s, encoding, errors) UnicodeDecodeError at /_admin/PyLucid/pagesinternal/ page_admin.edit_page/ 'utf8' codec can't decode byte 0xad in position 4: unexpected code byte ---------------------------------------------------------------- But i think this is not a real UnicodeDecodeError... It's a problem with the quote()/unquote() routines in django.contrib.admin.views.main.py The string before unquote() is..: page_admin.edit_page The string after unquote() is...: page\ufffdmin.edit_page In a local test, it seems to work fine: ---------------------------------------------------------------- from django.contrib.admin.views.main import quote, unquote TEST_STRING = "page_admin.edit_page" q = quote(TEST_STRING) print "quote():", q print "unquote():", unquote(q) print print "unquote()2:", unquote(TEST_STRING) ---------------------------------------------------------------- output: ---------------------------------------------------------------- quote(): page_5Fadmin.edit_5Fpage unquote(): page_admin.edit_page unquote()2: page\ufffdmin.edit_page ---------------------------------------------------------------- But, in my case, the real input for unquote() is not the quoted one like "page_5Fadmin.edit_5Fpage"! It is the non-quoted one like: "page_admin.edit_page" And then the unquote() break the string into: "page \ufffdmin.edit_page" It this a django bug? -- Mfg. Jens Diemer ---- A django powered CMS: http://www.pylucid.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---