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

SeedDB bulk import of organizations and rooms crashes on misformatted attribute lists #1532

Closed
lunkwill42 opened this issue Jul 19, 2017 · 0 comments
Assignees
Milestone

Comments

@lunkwill42
Copy link
Member

lunkwill42 commented Jul 19, 2017

It appears the bulk import code for Organization and Room does not attempt to properly validate the syntax of their attr fields, causing a ValueError crash (NAV 4.7.0 and earlier).

As an example, attempting to bulk import this as an Organization:

INGSOC::English Socialism:doubleplusgood

will result in a crash with a traceback that looks like this:

ValueError: dictionary update sequence element #0 has length 1; 2 is required
Traceback (most recent call last): 
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) 
File "/usr/lib/python2.7/dist-packages/nav/web/seeddb/page/organization.py", line 95, in organization_bulk extra_context=info.template_context) 
File "/usr/lib/python2.7/dist-packages/nav/web/seeddb/utils/bulk.py", line 46, in render_bulkimport processed = form.bulk_process_check(importer) 
File "/usr/lib/python2.7/dist-packages/nav/web/seeddb/forms/bulk.py", line 99, in bulk_process_check for line_num, objects in importer: 
File "/usr/lib/python2.7/dist-packages/nav/bulkimport.py", line 49, in next objects = self._create_objects_from_row(row) 
File "/usr/lib/python2.7/dist-packages/nav/bulkimport.py", line 215, in _create_objects_from_row attributes = dict([attr.split('=', 1) for attr in row.get('attr', [])]) 
ValueError: dictionary update sequence element #0 has length 1; 2 is required 
@lunkwill42 lunkwill42 added this to the 4.7.2 milestone Jul 19, 2017
@lunkwill42 lunkwill42 self-assigned this Jul 19, 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

1 participant