Unnecessary "is None" check in to_python

Issue #16 resolved
Gordon NA
created an issue

the following:

            if value is None:
                return None

at https://bitbucket.org/schinckel/django-jsonfield/src/77c170d16a053304a90364a1eb5c3d8822e58169/jsonfield/fields.py?at=default#cl-64

should be removed. Value will never be None because of isinstance(value, basestring) and value is returned as if it isinstance(value, basestring) is False

Comments (3)

  1. Gordon NA reporter

    I figured. Was just looking through the source to see if I could check for None or not.

    The way it is written now, the check isn't needed at all because the to_python method returns value unaltered if the input isn't a string.

    If you implement the #TODO note, it may make sense to check for None explicitly

  2. Log in to comment