summaryrefslogtreecommitdiff
path: root/django/newforms/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/newforms/util.py')
-rw-r--r--django/newforms/util.py5
1 files changed, 5 insertions, 0 deletions
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):