mysociety / sayit.mysociety.org

A hosting service for data using the SayIt component
http://sayit.mysociety.org/
Other
5 stars 4 forks source link

error deleting instance admin interface #87

Open johnfelipe opened 9 years ago

johnfelipe commented 9 years ago

500 - Internal Server Error

Something went wrong. Sorry.

(virtualenv-sayit)notroot@felipeurrego:~/sayit/sayit.mysociety.org$ gunicorn sayit_mysociety_org.wsgi
Internal Server Error: /admin/instances/instance/
Traceback (most recent call last):
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 452, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 198, in inner
    return view(request, *args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/decorators.py", line 29, in _wrapper
    return bound_func(*args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in bound_func
    return func(self, *args2, **kwargs2)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1351, in changelist_view
    response = self.response_action(request, queryset=cl.get_queryset(request))
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1104, in response_action
    response = func(self, request, queryset)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/actions.py", line 36, in delete_selected
    queryset, opts, request.user, modeladmin.admin_site, using)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 137, in get_deleted_objects
    to_delete = collector.nested(format_callback)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 191, in nested
    roots.extend(self._nested(root, seen, format_callback))
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 174, in _nested
    children.extend(self._nested(child, seen, format_callback))
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 176, in _nested
    ret = [format_callback(obj)]
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 130, in format_callback
    obj)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/html.py", line 79, in format_html
    args_safe = map(conditional_escape, args)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/html.py", line 71, in conditional_escape
    return escape(text)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/functional.py", line 203, in wrapper
    return func(*args, **kwargs)
  File "/home/notroot/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/utils/html.py", line 39, in escape
    return mark_safe(force_text(text).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

How fix this, tnks

dracos commented 9 years ago

When you delete something through the admin, it shows you a list of every related thing it is also going to delete, which for an instance means every speech, section, speaker in that instance. You have not given enough information, but I can only assume one of those is not correctly UTF-8 encoded and so causes an error when trying to be displayed on that "delete confirmation" page. What instance did you try to delete, what was its label and description? Is the issue reproducible if you create and delete another instance with the same details? If you look through the sections, speakers, speeches, does one of them have a bad encoding? There must be an issue with the name/heading of one of those.

johnfelipe commented 9 years ago

Hi, this is xml upload with ./manage.py load_akomantoso --file....

https://github.com/johnfelipe/akomantosomedellin/tree/199-a-210

0 errors.

But still haven delete that instance, please tell me how fix it

500 - Internal Server Error

Something went wrong. Sorry.