From: Leandro Lucarella Date: Mon, 26 Feb 2007 22:27:14 +0000 (+0000) Subject: Arreglar bug en ParamsValidator de ParamsCol. X-Git-Tag: pre-merge~79 X-Git-Url: https://git.llucax.com/software/sercom.git/commitdiff_plain/9dd936c95bb13b4cf8da055a28d57c32fc2861e2?hp=1de79f96462676120aa8a423ca849cfa7c6a959f Arreglar bug en ParamsValidator de ParamsCol. Ahora el validator de ParamsCol acepta a None como un valor permitido (y devuelve una lista vacĂ­a). --- diff --git a/sercom/model.py b/sercom/model.py index a3897ac..c01b63c 100644 --- a/sercom/model.py +++ b/sercom/model.py @@ -49,7 +49,7 @@ class TupleCol(PickleCol): class ParamsValidator(UnicodeStringValidator): def to_python(self, value, state): - if isinstance(value, basestring): + if isinstance(value, basestring) or value is None: value = super(ParamsValidator, self).to_python(value, state) try: value = params_to_list(value) @@ -64,7 +64,7 @@ class ParamsValidator(UnicodeStringValidator): def from_python(self, value, state): if isinstance(value, (list, tuple)): value = ' '.join([repr(p) for p in value]) - elif isinstance(value, basestring): + elif isinstance(value, basestring) or value is None: value = super(ParamsValidator, self).to_python(value, state) try: params_to_list(value)