﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11932	smart_unicode does not always return a unicode	Rachel Willmer	nobody	"Django 1.0.2, python 2.6

I'm using !BeautifulSoup to parse some XML which I then use as filter into the django database.

If I extract a field from the XML, I get an object of class !BeautifulSoup.!NavigableString.

If I then call smart_unicode(obj), I still have an object of class !BeautifulSoup.!NavigableString rather than the unicode I was expecting.

If I then use this as a filter into django, .e.g product = Product.objects.get(obj=obj), I get this error:
{{{
  File ""/var/lib/python-support/python2.6/django/db/models/manager.py"", line 93, in get
    return self.get_query_set().get(*args, **kwargs)
  File ""/var/lib/python-support/python2.6/django/db/models/query.py"", line 304, in get
    num = len(clone)
  File ""/var/lib/python-support/python2.6/django/db/models/query.py"", line 160, in __len__
    self._result_cache = list(self.iterator())
  File ""/var/lib/python-support/python2.6/django/db/models/query.py"", line 275, in iterator
    for row in self.query.results_iter():
  File ""/var/lib/python-support/python2.6/django/db/models/sql/query.py"", line 206, in results_iter
    for rows in self.execute_sql(MULTI):
  File ""/var/lib/python-support/python2.6/django/db/models/sql/query.py"", line 1734, in execute_sql
    cursor.execute(sql, params)
  File ""/var/lib/python-support/python2.6/django/db/backends/postgresql/base.py"", line 52, in execute
    return self.cursor.execute(smart_str(sql, self.charset), self.format_params(params))
  File ""/var/lib/python-support/python2.6/django/db/backends/postgresql/base.py"", line 49, in format_params
    return tuple([smart_str(p, self.charset, True) for p in params])
  File ""/var/lib/python-support/python2.6/django/utils/encoding.py"", line 95, in smart_str
    return s.encode(encoding, errors)
TypeError: encode() takes at most 2 arguments (3 given)
}}}"		closed	Uncategorized	1.0		invalid			Unreviewed	0	0	0	0	0	0
