Commits

Olemis Lang committed 6e50706

BH Dashboard #338 : BoolField implemented using classes

Comments (0)

Files changed (1)

t338/t338_r1427886_BoolField.diff

 # HG changeset patch
-# Parent d143652322b7ec13c6bd1f0b7aaf7fa01297ba6a
+# Parent c13bcf01260ad2413ab1c42aed067617af0a5544
 BH Dashboard #338 : Boolean fields for widget parameters
 
-diff -r d143652322b7 bloodhound_dashboard/bhdashboard/api.py
---- a/bloodhound_dashboard/bhdashboard/api.py	Wed Jan 02 18:06:37 2013 +0000
-+++ b/bloodhound_dashboard/bhdashboard/api.py	Mon Jan 07 13:28:47 2013 -0500
+diff -r c13bcf01260a bloodhound_dashboard/bhdashboard/api.py
+--- a/bloodhound_dashboard/bhdashboard/api.py	Tue Jan 08 15:10:18 2013 +0000
++++ b/bloodhound_dashboard/bhdashboard/api.py	Fri Jan 11 19:19:19 2013 -0500
 @@ -34,6 +34,7 @@
          Interface, TracError
  from trac.perm import IPermissionRequestor
  from trac.util.compat import set
  from trac.util.datefmt import parse_date
  from trac.util.translation import _
-@@ -411,3 +412,5 @@
+@@ -411,3 +412,15 @@
          else:
              return loads(value)
  
-+BoolField = as_bool
++class BoolField:
++    """Convert boolean field
++    """
++    def __call__(self, value):
++        """Perform the actual conversion
++        """
++        try:
++            return as_bool(value)
++        except Exception, exc:
++            raise InvalidWidgetArgument(error=exc, 
++                    title=_('Boolean conversion error'))
 +