1. Bruce Kroeze
  2. django-livesettings
  3. Issues
Issue #25 resolved

TypeError with empty IntegerValue

Hynek Cernoch
created an issue

IntegerValue, ModuleValue and some other value types, which are rendered like text field, raise an exception, if the content of the textbox have been deleted and the form is being saved.

{{{

/.../python2.5/django_livesettings/livesettings/values.py in to_python, line 508 (to_python) -> return int(value) TypeError at /settings/ int() argument must be a string or a number, not 'NoneType' }}} How should I solve it? Possibilities are:

Insert automatically the default value.

Insert automacitally Zero.

Make that field required.

PositiveIntegerValue is automatically required because of validation rule for the minimal value.

Comments (2)

  1. Hynek Cernoch reporter

    It was easy to safely gues, what had been the expected solution: - Fields which has "kwargs['required'] = False" shold be not required.
    - Fields which has 'if value == NOTSET: return "0"' should also replace an empty field by 0. - Integer and PositiveInteger should be similar.

    Also all values which are based on numbers use "0" for empty field. No field raises exception. No field is required.

    Fixed in 2e6489f70585

  2. Log in to comment