Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

newforms: Moved flatatt function from widgets.py to util.py

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4370 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 93eebd95cb59f4c54779db1dc8c2c166a36400fa 1 parent a154d94
Adrian Holovaty authored January 20, 2007
4  django/newforms/forms.py
@@ -5,8 +5,8 @@
5 5
 from django.utils.datastructures import SortedDict, MultiValueDict
6 6
 from django.utils.html import escape
7 7
 from fields import Field
8  
-from widgets import flatatt, TextInput, Textarea, HiddenInput, MultipleHiddenInput
9  
-from util import StrAndUnicode, ErrorDict, ErrorList, ValidationError
  8
+from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
  9
+from util import flatatt, StrAndUnicode, ErrorDict, ErrorList, ValidationError
10 10
 
11 11
 __all__ = ('BaseForm', 'Form')
12 12
 
5  django/newforms/util.py
... ...
@@ -1,4 +1,9 @@
1 1
 from django.conf import settings
  2
+from django.utils.html import escape
  3
+
  4
+# Converts a dictionary to a single string with key="value", XML-style with
  5
+# a leading space. Assumes keys do not need to be XML-escaped.
  6
+flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
2 7
 
3 8
 def smart_unicode(s):
4 9
     if not isinstance(s, basestring):
6  django/newforms/widgets.py
@@ -8,7 +8,7 @@
8 8
     'Select', 'SelectMultiple', 'RadioSelect', 'CheckboxSelectMultiple',
9 9
 )
10 10
 
11  
-from util import StrAndUnicode, smart_unicode
  11
+from util import flatatt, StrAndUnicode, smart_unicode
12 12
 from django.utils.datastructures import MultiValueDict
13 13
 from django.utils.html import escape
14 14
 from itertools import chain
@@ -18,10 +18,6 @@
18 18
 except NameError:
19 19
     from sets import Set as set # Python 2.3 fallback
20 20
 
21  
-# Converts a dictionary to a single string with key="value", XML-style with
22  
-# a leading space. Assumes keys do not need to be XML-escaped.
23  
-flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
24  
-
25 21
 class Widget(object):
26 22
     is_hidden = False          # Determines whether this corresponds to an <input type="hidden">.
27 23
 

0 notes on commit 93eebd9

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