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

TypeError when validating tree import multichoice field value #3096

Open
jwalgran opened this issue Apr 7, 2017 · 1 comment
Open

TypeError when validating tree import multichoice field value #3096

jwalgran opened this issue Apr 7, 2017 · 1 comment

Comments

@jwalgran
Copy link
Contributor

jwalgran commented Apr 7, 2017

https://rollbar.com/Azavea/OpenTreeMap/items/2377/

Traceback (most recent call last):
 File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
   R = retval = fun(*args, **kwargs)
 File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 438, in __protected_call__
   return self.run(*args, **kwargs)
 File "/opt/app/core/opentreemap/importer/tasks.py", line 138, in _validate_rows
   row.validate_row()
 File "/opt/app/core/opentreemap/importer/models/trees.py", line 439, in validate_row
   self.validate_user_defined_fields()
 File "/opt/app/core/opentreemap/importer/models/trees.py", line 416, in validate_user_defined_fields
   udf_def.clean_value(value)
 File "/opt/app/core/opentreemap/treemap/udf.py", line 880, in clean_value
   map(_validate, values)
TypeError: argument 2 to map() must support iteration

screen shot 2017-04-07 at 8 14 41 am

@jwalgran
Copy link
Contributor Author

jwalgran commented Apr 7, 2017

The problem appears to be caused by the fact that json.loads returns an integer when passed "0", and we expect it to return a string.

In [1]: import json

In [2]: json.loads("0")
Out[2]: 0

In [3]: type(Out[2])
Out[3]: int

@dboyer dboyer added the medium label Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants