Opened 17 years ago

Closed 17 years ago

#5770 closed (fixed)

Unicode error in admin documentation

Reported by: tobutaz+bugs@… Owned by: nobody
Component: contrib.admin Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

You can use the french locale to trigger the bug.

Go to the admin doc view, go to the tags view: /admin/doc/tags/

According to the backtrace, django has problems with this translation:

#: contrib/admin/views/doc.py:46 contrib/admin/views/doc.py:48
#: contrib/admin/views/doc.py:50
msgid "tag:"
msgstr "mot-clé :"

backtrace:

Traceback (most recent call last):
File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response
  72. response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/datas/pressblog/bin/pressblog/middleware/stats.py" in process_view
  28. response = view_func(request, *view_args, **view_kwargs)
File "/var/lib/python-support/python2.5/django/contrib/admin/views/decorators.py" in _checklogin
  55. return view_func(request, *args, **kwargs)
File "/var/lib/python-support/python2.5/django/contrib/admin/views/doc.py" in template_tag_index
  48. body = utils.parse_rst(body, 'tag', _('tag:') + tag_name)
File "/var/lib/python-support/python2.5/django/contrib/admin/utils.py" in parse_rst
  68. settings_overrides=overrides)
File "/usr/lib/python2.5/site-packages/docutils/core.py" in publish_parts
  431. enable_exit_status=enable_exit_status)
File "/usr/lib/python2.5/site-packages/docutils/core.py" in publish_programmatically
  612. output = pub.publish(enable_exit_status=enable_exit_status)
File "/usr/lib/python2.5/site-packages/docutils/core.py" in publish
  204. self.settings)
File "/usr/lib/python2.5/site-packages/docutils/readers/__init__.py" in read
  71. self.parse()
File "/usr/lib/python2.5/site-packages/docutils/readers/__init__.py" in parse
  77. self.parser.parse(self.input, document)
File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/__init__.py" in parse
  155. self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py" in run
  171. input_source=document['source'])
File "/usr/lib/python2.5/site-packages/docutils/statemachine.py" in run
  234. context, state, transitions)
File "/usr/lib/python2.5/site-packages/docutils/statemachine.py" in check_line
  422. return method(match, context, next_state)
File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py" in text
  2631. source=source, line=lineno)
File "/usr/lib/python2.5/site-packages/docutils/utils.py" in error
  209. return self.system_message(3, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/docutils/utils.py" in system_message
  172. msgtext = msg.astext().encode(self.encoding, self.error_handler)
File "/usr/lib/python2.5/site-packages/docutils/nodes.py" in astext
  1310. self['level'], Element.astext(self))

  UnicodeDecodeError at /admin/doc/tags/
  'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

Change History (3)

comment:1 by durdinator, 17 years ago

I can't replicate this on trunk -- although the /admin/doc/tags/ page doesn't appear to be translating that string anywhere, as "mot-clé" is nowhere on the page. Have you got any nonstandard tag libraries installed that might be triggering the error?

comment:2 by anonymous <tobutaz+bugs@…>, 17 years ago

I've just checked, _('tag:') does appear in

File "/var/lib/python-support/python2.5/django/contrib/admin/views/doc.py" in template_tag_index
  48. body = utils.parse_rst(body, 'tag', _('tag:') + tag_name)

Maybe you don't have the french translation installed (I'm using a distribution package), you could then hardcode it in doc.py to trigger the bug.

Also, I have this in settings.py: LANGUAGE_CODE = 'fr-FR'

comment:3 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

Non-ASCII characters in translations were a problem in 0.96. This is fixed on trunk, though. Firstly because the error that was trying to be displayed is fixed in [6539] and secondly because we use ugettext() everywhere.

Please reopen if you can repeat it on trunk, but as far as I can work out, it's fixed (I could generate the problem in 0.96, but not in trunk).

Note: See TracTickets for help on using tickets.
Back to Top