Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed some Python 2.3 unicode conversion problems. Uncovered by the t…

…ests, but that was just a sign of a real bug (luckily!).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6266 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c59903101a6fbef18c18682b4fdea8d997bc7d4f 1 parent 072dfaa
Malcolm Tredinnick authored September 15, 2007

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. 11  django/newforms/util.py
11  django/newforms/util.py
... ...
@@ -1,5 +1,5 @@
1 1
 from django.utils.html import escape
2  
-from django.utils.encoding import smart_unicode, StrAndUnicode
  2
+from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode
3 3
 from django.utils.functional import Promise
4 4
 
5 5
 def flatatt(attrs):
@@ -22,10 +22,10 @@ def __unicode__(self):
22 22
 
23 23
     def as_ul(self):
24 24
         if not self: return u''
25  
-        return u'<ul class="errorlist">%s</ul>' % ''.join([u'<li>%s%s</li>' % (k, smart_unicode(v)) for k, v in self.items()])
  25
+        return u'<ul class="errorlist">%s</ul>' % ''.join([u'<li>%s%s</li>' % (k, force_unicode(v)) for k, v in self.items()])
26 26
 
27 27
     def as_text(self):
28  
-        return u'\n'.join([u'* %s\n%s' % (k, u'\n'.join([u'  * %s' % smart_unicode(i) for i in v])) for k, v in self.items()])
  28
+        return u'\n'.join([u'* %s\n%s' % (k, u'\n'.join([u'  * %s' % force_unicode(i) for i in v])) for k, v in self.items()])
29 29
 
30 30
 class ErrorList(list, StrAndUnicode):
31 31
     """
@@ -36,11 +36,11 @@ def __unicode__(self):
36 36
 
37 37
     def as_ul(self):
38 38
         if not self: return u''
39  
-        return u'<ul class="errorlist">%s</ul>' % ''.join([u'<li>%s</li>' % smart_unicode(e) for e in self])
  39
+        return u'<ul class="errorlist">%s</ul>' % ''.join([u'<li>%s</li>' % force_unicode(e) for e in self])
40 40
 
41 41
     def as_text(self):
42 42
         if not self: return u''
43  
-        return u'\n'.join([u'* %s' % smart_unicode(e) for e in self])
  43
+        return u'\n'.join([u'* %s' % force_unicode(e) for e in self])
44 44
 
45 45
 class ValidationError(Exception):
46 46
     def __init__(self, message):
@@ -58,3 +58,4 @@ def __str__(self):
58 58
         # AttributeError: ValidationError instance has no attribute 'args'
59 59
         # See http://www.python.org/doc/current/tut/node10.html#handling
60 60
         return repr(self.messages)
  61
+

0 notes on commit c599031

Please sign in to comment.
Something went wrong with that request. Please try again.