DoesNotExist exception on some users profile page

asked 2013-02-04 03:45:29 -0600

Fabien Meghazi gravatar image

On an askbot running pip version 0.7.48, I've got an exception on the profile page of 3 users. I don't get the relation between those three user, I guess they have a broken relation or something but I don't know how to trace it.

Here's the traceback:

  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/askbot/views/users.py", line 1123, in user
    return user_view_func(request, profile_owner, context)

  File "/usr/local/lib/python2.7/dist-packages/askbot/views/users.py", line 531, in user_stats
    return render(request, 'user_profile/user_stats.html', context)

  File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/__init__.py", line 44, in render
    return HttpResponse(loader.render_to_string(*args, **kwargs),

  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 176, in render_to_string
    return t.render(context_instance)

  File "/usr/local/lib/python2.7/dist-packages/coffin/template/__init__.py", line 55, in render
    return super(Template, self).render(**context)

  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/user_profile/user_stats.html", line 3, in top-level template code
    {% import "user_profile/macros.html" as user_profile_macros %}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/user_profile/user.html", line 1, in top-level template code
    {% extends "one_column_body.html" %}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/one_column_body.html", line 1, in top-level template code
    {% extends "base.html" %}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/base.html", line 53, in top-level template code
    {% block body %}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/one_column_body.html", line 5, in block "body"
    {% block content%}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/user_profile/user.html", line 17, in block "content"
    {% block usercontent %}

  File "/usr/local/lib/python2.7/dist-packages/askbot/templates/user_profile/user_stats.html", line 131, in block "usercontent"
    href="{{ award.content_object.get_absolute_url() }}"

  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 11, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 883, in get_absolute_url
    return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label, opts.module_name), func)(self, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/askbot/models/post.py", line 759, in get_absolute_url
    question_post = self.thread._question_post()

  File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py", line 586, in _question_post
    self._question_cache = Post.objects.get(post_type='question', thread=self)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 131, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 367, in get
    % self.model._meta.object_name)

DoesNotExist: Post matching query does not exist.
edit retag flag offensive close merge delete

Comments

Replying to myself, I could trace the id of the thread causing problem at File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py", line 586, I used the admin in order to delete the thread and now the user pages are ok. So it was a relation missing. Not sure how it could happen as they are foreign key checks in postgres, ...

Fabien Meghazi gravatar imageFabien Meghazi ( 2013-02-07 02:43:40 -0600 )edit