Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot have null inside a string list? #111

Open
dannyroberts opened this issue Oct 13, 2014 · 0 comments
Open

Cannot have null inside a string list? #111

dannyroberts opened this issue Oct 13, 2014 · 0 comments

Comments

@dannyroberts
Copy link
Member

>>> import jsonobject
>>> class Foo(jsonobject.JsonObject):
...     string_list = jsonobject.ListProperty(unicode)
... 
>>> foo = Foo()
>>> foo.string_list.append(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/droberts/.virtualenvs/cchq/lib/python2.7/site-packages/jsonobject/containers.py", line 26, in append
    wrapped, unwrapped = self._wrapper.unwrap(wrapped)
  File "/Users/droberts/.virtualenvs/cchq/lib/python2.7/site-packages/jsonobject/base_properties.py", line 277, in unwrap
    self.assert_type(obj)
  File "/Users/droberts/.virtualenvs/cchq/lib/python2.7/site-packages/jsonobject/base_properties.py", line 264, in assert_type
    '{0!r} not of type {1!r}'.format(obj, self._type)
jsonobject.exceptions.BadValueError: None not of type (<type 'unicode'>, <type 'str'>)

This should work fine—or at least there should be some way to specify that None is an ok value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant