field debug helper tls-sprint
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 20 Feb 2009 15:59:43 +0100
branchtls-sprint
changeset 900 8f95ebbe2fd8
parent 899 48d465b5171a
child 901 0dcf01eb97a0
field debug helper
web/form.py
--- a/web/form.py	Fri Feb 20 15:58:46 2009 +0100
+++ b/web/form.py	Fri Feb 20 15:59:43 2009 +0100
@@ -403,7 +403,6 @@
         if widget is not None:
             self.widget = widget
         if isinstance(self.widget, type):
-            print 'widget', self.widget
             self.widget = self.widget()
         self.name = name
         self.label = label or name
@@ -428,6 +427,14 @@
     def actual_fields(self, form):
         yield self
 
+    def __unicode__(self):
+        return u'<%s name=%r label=%r id=%r initial=%r>' % (
+            self.__class__.__name__, self.name, self.label,
+            self.id, self.initial)
+
+    def __repr__(self):
+        return self.__unicode__().encode('utf-8')
+    
     def format_value(self, req, value):
         return unicode(value)