* fix: informative type mismatch message

* don't match None types
This commit is contained in:
Eray Özkural
2005-10-31 17:27:56 +00:00
parent 0955ef30ca
commit db8b20569b
+3 -3
View File
@@ -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):