From db8b20569b6788694cb6155311d577e83fa24473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 31 Oct 2005 17:27:56 +0000 Subject: [PATCH] * fix: informative type mismatch message * don't match None types --- pisi/xmlfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index a1cb599f..5fced6b8 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -479,7 +479,6 @@ class autoxml(oo.autosuper): def encode(xml, node, value, errs): """encode given value inside DOM node""" if value: - #FIXME: unicode() here? writetext(xml, node, token, unicode(value)) else: if req == mandatory: @@ -487,8 +486,9 @@ class autoxml(oo.autosuper): def check(value, where): errs = [] - if not isinstance(value, token_type): - errs.append(where + _('Type mismatch')) + if value and not isinstance(value, token_type): + errs.append(where + _('Type mismatch. Expected %s, got %s') % + (token_type, type(value)) ) return errs def format(value, f, errs):