Author: adrian
Date: 2007-02-19 17:43:14 -0600 (Mon, 19 Feb 2007)
New Revision: 4543

Modified:
   django/trunk/django/newforms/fields.py
   django/trunk/tests/regressiontests/forms/tests.py
Log:
Improved newforms to handle wacky characters in Field help_text

Modified: django/trunk/django/newforms/fields.py
===================================================================
--- django/trunk/django/newforms/fields.py      2007-02-19 04:18:46 UTC (rev 
4542)
+++ django/trunk/django/newforms/fields.py      2007-02-19 23:43:14 UTC (rev 
4543)
@@ -51,7 +51,7 @@
         if label is not None:
             label = smart_unicode(label)
         self.required, self.label, self.initial = required, label, initial
-        self.help_text = help_text
+        self.help_text = smart_unicode(help_text or '')
         widget = widget or self.widget
         if isinstance(widget, type):
             widget = widget()

Modified: django/trunk/tests/regressiontests/forms/tests.py
===================================================================
--- django/trunk/tests/regressiontests/forms/tests.py   2007-02-19 04:18:46 UTC 
(rev 4542)
+++ django/trunk/tests/regressiontests/forms/tests.py   2007-02-19 23:43:14 UTC 
(rev 4543)
@@ -2698,6 +2698,13 @@
 <li>Username: <input type="text" name="username" maxlength="10" /> e.g., 
[EMAIL PROTECTED]</li>
 <li>Password: <input type="password" name="password" /><input type="hidden" 
name="next" value="/" /></li>
 
+Help text can include arbitrary Unicode characters.
+>>> class UserRegistration(Form):
+...    username = CharField(max_length=10, help_text='ŠĐĆŽćžšđ')
+>>> p = UserRegistration(auto_id=False)
+>>> p.as_ul()
+u'<li>Username: <input type="text" name="username" maxlength="10" /> 
\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111</li>'
+
 # Subclassing forms ###########################################################
 
 You can subclass a Form to add fields. The resulting form subclass will have


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to