Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@adrianholovaty adrianholovaty authored
View
4 django/newforms/forms.py
@@ -5,8 +5,8 @@
from django.utils.datastructures import SortedDict, MultiValueDict
from django.utils.html import escape
from fields import Field
-from widgets import flatatt, TextInput, Textarea, HiddenInput, MultipleHiddenInput
-from util import StrAndUnicode, ErrorDict, ErrorList, ValidationError
+from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
+from util import flatatt, StrAndUnicode, ErrorDict, ErrorList, ValidationError
__all__ = ('BaseForm', 'Form')
View
5 django/newforms/util.py
@@ -1,4 +1,9 @@
from django.conf import settings
+from django.utils.html import escape
+
+# Converts a dictionary to a single string with key="value", XML-style with
+# a leading space. Assumes keys do not need to be XML-escaped.
+flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
def smart_unicode(s):
if not isinstance(s, basestring):
View
6 django/newforms/widgets.py
@@ -8,7 +8,7 @@
'Select', 'SelectMultiple', 'RadioSelect', 'CheckboxSelectMultiple',
)
-from util import StrAndUnicode, smart_unicode
+from util import flatatt, StrAndUnicode, smart_unicode
from django.utils.datastructures import MultiValueDict
from django.utils.html import escape
from itertools import chain
@@ -18,10 +18,6 @@
except NameError:
from sets import Set as set # Python 2.3 fallback
-# Converts a dictionary to a single string with key="value", XML-style with
-# a leading space. Assumes keys do not need to be XML-escaped.
-flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
-
class Widget(object):
is_hidden = False # Determines whether this corresponds to an <input type="hidden">.
Please sign in to comment.
Something went wrong with that request. Please try again.