Hi Sebastien,

I don't see where the exact problem is and whether there's already a
ticket, but this is a bug within the newforms package. It is caused
due to newforms putting unicode into the models, but most parts of
Django are not unicode ready. You can search in the existing tickets
(with category == 'newforms') whether there's already a patch.

If not, could you please open a new ticket and provide exactly the
information from the mail I'm replying to? If you put {{{ and }}}
around the traceback and the code, it won't look as bad as in email
(it's always like this in mail). And please put a link to this
thread's google archive, if you can.

Sebastien Armand [Pink]:
> So the exact unicode error is:
> 
> UnicodeEncodeError at /entreprise/search/ 'ascii' codec can't encode
> character u'\xe9' in position 1: ordinal not in range(128) Request Method:
> POST  Request URL: http://localhost/entreprise/search/  Exception Type:
> UnicodeEncodeError  Exception Value: 'ascii' codec can't encode character
> u'\xe9' in position 1: ordinal not in range(128)  Exception Location:
> c:\Python25\lib\site-packages\django\db\models\fields\__init__.py
> in , line 25
> 
> with the following traceback:
> 
> Traceback (most recent call last):
> File "c:\Python25\lib\site-packages\django\template\__init__.py" in
> render_node
>   712. result = node.render(context)
> File "c:\Python25\lib\site-packages\django\template\defaulttags.py" in
> render
>   100. len_values = len(values)
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in __len__
>   100. return len(self._get_data())
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in _get_data
>   430. self._result_cache = list(self.iterator())
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in iterator
>   171. select, sql, params = self._get_sql_clause()
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in
> _get_sql_clause
>   444. joins2, where2, params2 = self._filters.get_sql(opts)
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in get_sql
>   574. joins2, where2, params2 = val.get_sql(opts)
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in get_sql
>   622. return parse_lookup(self.kwargs.items(), opts)
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in
> parse_lookup
>   743. joins2, where2, params2 = lookup_inner(path, lookup_type, value,
> opts, opts.db_table, None)
> File "c:\Python25\lib\site-packages\django\db\models\query.py" in
> lookup_inner
>   915. params.extend(field.get_db_prep_lookup(lookup_type, value))
> File "c:\Python25\lib\site-packages\django\db\models\fields\__init__.py" in
> get_db_prep_lookup
>   172. return ["%%%s%%" % prep_for_like_query(value)]
> File "c:\Python25\lib\site-packages\django\db\models\fields\__init__.py" in
>   25. prep_for_like_query = lambda x: str(x).replace("\\",
> "\\\\").replace("%", "\%").replace("_", "\_")

the str(x) throws this exception when x is not an ASCII character.

> 
>   UnicodeEncodeError at /entreprise/search/
>   'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in
> range(128)

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to