diff --git a/modules/plugin_dbui/__init__.py b/modules/plugin_dbui/__init__.py index 68d52b772687386443d6e033fe7b9a21c36a3910..1522463d60eb398bb6177b798964e8602df0aec9 100644 --- a/modules/plugin_dbui/__init__.py +++ b/modules/plugin_dbui/__init__.py @@ -82,6 +82,7 @@ from helper import (as_list, from mapper import map_default, map_tabpanel from navtree import Node from selector import Selector +from validators import IS_IN_USET from viewportmodifier import ViewportModifier UNDEF = 'undefined' diff --git a/modules/plugin_dbui/validators.py b/modules/plugin_dbui/validators.py new file mode 100644 index 0000000000000000000000000000000000000000..1ea21311638ad0601729400e6ed2dc081a55b707 --- /dev/null +++ b/modules/plugin_dbui/validators.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" validators + +@author: R. Le Gac + +""" +from gluon.validators import IS_IN_SET + + +class IS_IN_USET(IS_IN_SET): + """IS_IN_SET validator but working with unicode string. + + """ + + def __init__(self, theset, **kwargs): + + myset = [] + + if isinstance(theset, (list, tuple)): + for el in theset: + if isinstance(el, unicode): + el = el.encode("utf-8") + myset.append(el) + + elif isinstance(theset, dict): + myset = {} + for key in theset: + if isinstance(key, unicode): + myset[key.encode("utf-8")] = theset[key] + else: + myset[key] = theset[key] + + IS_IN_SET.__init__(self, myset, **kwargs) + + + def __call__(self, value): + + if isinstance(value, unicode): + value = value.encode("utf-8") + + return IS_IN_SET.__call__(self, value) + \ No newline at end of file diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index 746eda158f50a8915dab907892dcabb394c92397..a4a1e411a680265bc2de9c419192428f78bc7d07 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -3,7 +3,8 @@ HEAD - Add the plugin App.grid.plugin.Export. - Mask the whole viewport during loading a PanelWithUrlSelector. - - Version information can be export via the plugin pGridExport. + - Data on version can be export via the plugin pGridExport. + - Add the validator IS_IN_USET. 0.6.1.7 (Sep 2014) - Use inline script and Ext.grid.Panel to display software versions