new append_field method tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 07 Apr 2009 19:53:03 +0200
branchtls-sprint
changeset 1272 e710fc46c6a0
parent 1271 0a5257f5d723
child 1273 64e1db70161b
new append_field method
web/form.py
--- a/web/form.py	Tue Apr 07 19:52:52 2009 +0200
+++ b/web/form.py	Tue Apr 07 19:53:03 2009 +0200
@@ -247,6 +247,14 @@
             fields = cls_or_self.fields
         fields.remove(field)
     
+    @iclassmethod
+    def append_field(cls_or_self, field):
+        if isinstance(cls_or_self, type):
+            fields = cls_or_self._fields_
+        else:
+            fields = cls_or_self.fields
+        fields.append(field)
+    
     @property
     def form_needs_multipart(self):
         return any(field.needs_multipart for field in self.fields)