gklyne / annalist

Free-form web data notebook - "Data management for little guys"
MIT License
25 stars 3 forks source link

Copying view gets "500 server error" #38

Closed gklyne closed 10 years ago

gklyne commented 10 years ago

It looks as if the problem is related to lack of an annal:uri field. I was trying to copy a view record without a URI. This line should specify a default value:

  File "/home/annalist/anenv/lib/python2.7/site-packages/annalist_root/annalist/views/entityedit.py", line 307, in form_render
    entityvals.pop(ANNAL.CURIE.uri)
KeyError: 'annal:uri'

Do a code-wide search for dictionary .pop functions and check they specify default values where needed (at one point, I thought the default just defaulted to None).

From the server log:

INFO 2014-11-21 16:59:16,383 views.entityedit.get:  coll_id test, type_id _view, entity_id Data_view, view_id View_view, action copy
ERROR 2014-11-21 16:59:16,464 Internal Server Error: /annalist/c/test/v/View_view/_view/Data_view/!copy
Traceback (most recent call last):
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/annalist/anenv/lib/python2.7/site-packages/annalist_root/annalist/views/entityedit.py", line 127, in get
    return self.form_render(viewinfo, entity, add_field, continuation_url)
  File "/home/annalist/anenv/lib/python2.7/site-packages/annalist_root/annalist/views/entityedit.py", line 307, in form_render
    entityvals.pop(ANNAL.CURIE.uri)
KeyError: 'annal:uri'
ERROR 2014-11-21 16:59:16,464 Internal Server Error: /annalist/c/test/v/View_view/_view/Data_view/!copy
Traceback (most recent call last):
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/annalist/anenv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/annalist/anenv/lib/python2.7/site-packages/annalist_root/annalist/views/entityedit.py", line 127, in get
    return self.form_render(viewinfo, entity, add_field, continuation_url)
  File "/home/annalist/anenv/lib/python2.7/site-packages/annalist_root/annalist/views/entityedit.py", line 307, in form_render
    entityvals.pop(ANNAL.CURIE.uri)
KeyError: 'annal:uri'
gklyne commented 10 years ago

Fixed in hot fix release 0.1.6a (730a614fcabcb48cb3afb92b4984ad9403484241); also on development branch