use empty string instead of None as possible context value to avoid getting an <optgroup> tag in associated widget
authorsylvain.thenault@logilab.fr
Mon, 19 Jan 2009 19:57:41 +0100
changeset 446 3a3ab6bbccc5
parent 445 18cc518d5e33
child 447 0e52d72104a6
use empty string instead of None as possible context value to avoid getting an <optgroup> tag in associated widget
common/selectors.py
web/facet.py
--- a/common/selectors.py	Mon Jan 19 19:46:33 2009 +0100
+++ b/common/selectors.py	Mon Jan 19 19:57:41 2009 +0100
@@ -499,7 +499,7 @@
     propval = req.property_value('%s.%s.context' % (cls.__registry__, cls.id))
     if not propval:
         propval = cls.context
-    if context is not None and propval is not None and context != propval:
+    if context is not None and propval and context != propval:
         return 0
     return 1
 contextprop_selector = deprecated_function(match_context_prop)
--- a/web/facet.py	Mon Jan 19 19:46:33 2009 +0100
+++ b/web/facet.py	Mon Jan 19 19:57:41 2009 +0100
@@ -245,11 +245,11 @@
                            help=_('display order of the box')),
         _('context'): dict(type='String', default=None,
                            # None <-> both
-                           vocabulary=(_('tablefilter'), _('facetbox'), None),
+                           vocabulary=(_('tablefilter'), _('facetbox'), ''),
                            help=_('context where this box should be displayed')),
         }
     visible = True
-    context = None
+    context = ''
     needs_update = False
     start_unfolded = True