diff src/tools/xml_tools.py @ 993:301b342c697a

core: use of the new core.log module: /!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author Goffi <goffi@goffi.org>
date Sat, 19 Apr 2014 19:19:19 +0200
parents 58a57ce5932a
children 35048cafb18d
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Sat Apr 19 16:48:26 2014 +0200
+++ b/src/tools/xml_tools.py	Sat Apr 19 19:19:19 2014 +0200
@@ -18,7 +18,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
-from logging import debug, info, error, warning
+from sat.core.log import getLogger
+log = getLogger(__name__)
 from xml.dom import minidom, NotFoundErr
 from wokkel import data_form
 from twisted.words.xish import domish
@@ -46,7 +47,7 @@
         widget_type = 'text'
         if field.value is None:
             if field.label is None:
-                warning(_("Fixed field has neither value nor label, ignoring it"))
+                log.warning(_("Fixed field has neither value nor label, ignoring it"))
                 field.value = ""
             else:
                 field.value = field.label
@@ -65,7 +66,7 @@
         del widget_args[0]
         widget_kwargs["options"] = [(option.value, option.label or option.value) for option in field.options]
     else:
-        error(u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
+        log.error(u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
         widget_type = "string"
 
     if field.var:
@@ -131,7 +132,7 @@
     for item_elt in item_elts:
         for elt in item_elt.elements():
             if elt.name != 'field':
-                warning("Unexpected tag (%s)" % elt.name)
+                log.warning("Unexpected tag (%s)" % elt.name)
                 continue
             field = data_form.Field.fromElement(elt)
 
@@ -699,7 +700,7 @@
             style = set()
         styles = set(style)
         if not options:
-            warning(_('empty "options" list'))
+            log.warning(_('empty "options" list'))
         if not styles.issubset(['multi']):
             raise exceptions.DataError(_("invalid styles"))
         super(ListWidget, self).__init__(xmlui, name, parent)