Ahora el validator de ParamsCol acepta a None como un valor permitido (y
devuelve una lista vacía).
class ParamsValidator(UnicodeStringValidator):
def to_python(self, value, state):
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)
value = super(ParamsValidator, self).to_python(value, state)
try:
value = params_to_list(value)
def from_python(self, value, state):
if isinstance(value, (list, tuple)):
value = ' '.join([repr(p) for p in value])
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)
value = super(ParamsValidator, self).to_python(value, state)
try:
params_to_list(value)