On 07-Oct-07, at 8:25 PM, Malcolm Tredinnick wrote:

> doing to cause the issue. It's also important to note which version of
> Python you are using, as well as the database and the database  
> encoding
> (and databse backend in the case of mysql or postgresql, since  
> there are
> differences between the choices). I recently looked at another i18n  
> bug
> of yours that appears to have been only caused with Python 2.3 and  
> that
> sort of information is important to know when diagnosing these things.

I could not give the full traceback as the problem occured on a  
production server and after I did a hack to fix it, I could not find  
the error message again. I have reproduced the problem. I am using  
python 2.4 and revision 6365. To reprduce the error, create a model  
with one field:

name = CharField of some some length and have
__unicode__() = "%s"  %(self.name)

in admin enter a finnish word with special characters like: Asikainen  
Päivi ja Jorma. On saving, or after saving, on trying to edit the  
word I get this error:


UnicodeDecodeError at /web/admin/web/sponsorship/80/
'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in  
range(128)
Request Method:         GET
Request URL:    http://fida.nrcfosshelpline.in/web/admin/web/ 
sponsorship/80/
Exception Type:         UnicodeDecodeError
Exception Value:        'ascii' codec can't decode byte 0xc3 in position  
17: ordinal not in range(128)
Exception Location:     /usr/lib/python2.4/site-packages/django/utils/ 
encoding.py in force_unicode, line 37
Python Executable:      /usr/bin/python
Python Version:         2.4.4
Unicode error hint

The string that could not be encoded/decoded was: nen P����iv
Template error

In template /usr/lib/python2.4/site-packages/django/contrib/admin/ 
templates/admin/change_form.html, error at line 15
Caught an exception while rendering: 'ascii' codec can't decode byte  
0xc3 in position 17: ordinal not in range(128)
5       {% for js in javascript_imports %}{% include_admin_script js %}{%  
endfor %}
6       {% endblock %}
7       {% block stylesheet %}{% admin_media_prefix %}css/forms.css{%  
endblock %}
8       {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{%  
endif %}{% endblock %}
9       {% block bodyclass %}{{ opts.app_label }}- 
{{ opts.object_name.lower }} change-form{% endblock %}
10      {% block userlinks %}<a href="../../../doc/">{% trans  
'Documentation' %}</a> / <a href="../../../password_change/">{% trans  
'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log  
out' %}</a>{% endblock %}
11      {% block breadcrumbs %}{% if not is_popup %}
12      <div class="breadcrumbs">
13      <a href="../../../">{% trans "Home" %}</a> &rsaquo;
14      <a href="../">{{ opts.verbose_name_plural|capfirst|escape }}</a>  
&rsaquo;
15      {% if add %}{% trans "Add" %} {{ opts.verbose_name|escape }}{%  
else %}{{ original|truncatewords:"18"|escape }}{% endif %}
16      </div>
17      {% endif %}{% endblock %}
18      {% block content %}<div id="content-main">
19      {% block object-tools %}
20      {% if change %}{% if not is_popup %}
21      <ul class="object-tools"><li><a href="history/"  
class="historylink">{% trans "History" %}</a></li>
22      {% if has_absolute_url %}<li><a href="../../../r/ 
{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans  
"View on site" %}</a></li>{% endif%}
23      </ul>
24      {% endif %}{% endif %}
25      {% endblock %}

I have left out the rest of the traceback since the above shows where  
the error is. If I delete this part of line 15 in change_form.html:

{% else %}{{ original|truncatewords:"18"|escape }}

then the error goes away - and some functionality also goes away. I  
am always reluctant to file bugs as that adds to your burden, but if  
you feel it is a bug, I will file one.


-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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

Reply via email to