diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-01-20 20:33:23 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-01-20 20:33:23 +0000 |
| commit | 93eebd95cb59f4c54779db1dc8c2c166a36400fa (patch) | |
| tree | 84cbfcd8e0f0f521ae819359cdb1af817782a2d5 | |
| parent | a154d94e456af97a05a6d630bd8ec7193d67684b (diff) | |
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
| -rw-r--r-- | django/newforms/forms.py | 4 | ||||
| -rw-r--r-- | django/newforms/util.py | 5 | ||||
| -rw-r--r-- | django/newforms/widgets.py | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py index 5964c9cc5e..1724a5a69f 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -5,8 +5,8 @@ Form classes 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') diff --git a/django/newforms/util.py b/django/newforms/util.py index a78623a17b..2fec9e4e2e 100644 --- a/django/newforms/util.py +++ b/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): diff --git a/django/newforms/widgets.py b/django/newforms/widgets.py index 4bbd02dc63..e18026485e 100644 --- a/django/newforms/widgets.py +++ b/django/newforms/widgets.py @@ -8,7 +8,7 @@ __all__ = ( '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 @@ try: 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">. |
