changeset 2297:84aad7171a56

allow for_= (translated to for=) in html.LABEL
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 10 Jul 2007 18:45:01 +0200
parents f22518801de4
children c81b9c983b1d
files MoinMoin/widget/html.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/widget/html.py	Tue Jul 10 18:43:00 2007 +0200
+++ b/MoinMoin/widget/html.py	Tue Jul 10 18:45:01 2007 +0200
@@ -431,8 +431,26 @@
     "form field label text"
     _ATTRS = {
         'class': None,
+        'for_': None,
     }
 
+    def _openingtag(self):
+        result = [self.tagname()]
+        attrs = self.attrs.items()
+        if _SORT_ATTRS:
+            attrs.sort()
+        for key, val in attrs:
+            key = key.lower()
+            if key == 'for_':
+                key = 'for'
+            if key in self._BOOL_ATTRS:
+                if val:
+                    result.append(key)
+            else:
+                result.append(u'%s="%s"' % (key, wikiutil.escape(val, 1)))
+        return ' '.join(result)
+
+
 class LI(CompositeElement):
     "list item"
     _ATTRS = {