The SIO2 project
  1. The SIO2 project
  2. SIO-2128

Forum category view breaks when there is thread without any posts

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Current Version
    • Fix Version/s: None
    • Component/s: OIOIOI
    • Labels:

      Description

      It can happen when all posts where deleted. Category view looks for author of last post in each thread and fails when there is thread with no last post.

        Activity

        Hide
        Zuzanna Opała added a comment -
        Traceback (most recent call last):
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response
            response = self.process_exception_by_middleware(e, request)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 172, in get_response
            response = response.render()
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/response.py", line 160, in render
            self.content = self.rendered_content
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/response.py", line 137, in rendered_content
            content = template.render(context, self._request)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/backends/django.py", line 95, in render
            return self.template.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 206, in render
            return self._render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render
            return self.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
            return compiled_parent._render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render
            return self.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
            return compiled_parent._render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render
            return self.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
            return compiled_parent._render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render
            return self.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render
            result = block.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render
            result = block.nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 326, in render
            return nodelist.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render
            bit = node.render_annotated(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 220, in render
            nodelist.append(node.render_annotated(context))
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
            return self.render(context)
          File "/media/data/sio2/oioioi/oioioi/contests/templatetags/get_user_name.py", line 25, in render
            'target_user': self.target_user.resolve(context),
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 850, in resolve
            value = self._resolve_lookup(context)
          File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 905, in _resolve_lookup
            (bit, current)) # missing attribute
        VariableDoesNotExist: Failed lookup for key [author] in u'None'
        Show
        Zuzanna Opała added a comment - Traceback (most recent call last):   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response     response = self.process_exception_by_middleware(e, request)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 172, in get_response     response = response.render()   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/response.py", line 160, in render     self.content = self.rendered_content   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/response.py", line 137, in rendered_content     content = template.render(context, self._request)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/backends/django.py", line 95, in render     return self.template.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 206, in render     return self._render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render     return self.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render     return compiled_parent._render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render     return self.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render     return compiled_parent._render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render     return self.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render     return compiled_parent._render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/test/utils.py", line 92, in instrumented_test_render     return self.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render     result = block.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render     result = block.nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 326, in render     return nodelist.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 992, in render     bit = node.render_annotated(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 220, in render     nodelist.append(node.render_annotated(context))   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated     return self.render(context)   File "/media/data/sio2/oioioi/oioioi/contests/templatetags/get_user_name.py", line 25, in render     'target_user': self.target_user.resolve(context),   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 850, in resolve     value = self._resolve_lookup(context)   File "/media/data/sio2/venv/local/lib/python2.7/site-packages/django/template/base.py", line 905, in _resolve_lookup     (bit, current)) # missing attribute VariableDoesNotExist: Failed lookup for key [author] in u'None'
        Hide
        Zuzanna Opała added a comment -
        Exact place:
        In template /sio2/oioioi/oioioi/forum/templates/forum/category.html, error at line 66:
        65 <small>
        66 {% full_name t.last_post.author as author_link %}
        67 {% blocktrans with date=t.last_post.add_date author=author_link last_id=t.last_post.id %}
        68 <a href="{{ thread_link }}#forum-post-{{ last_id }}">{{ date }}</a>, by {{ author }}
        69 {% endblocktrans %}
        70 </small>
        Show
        Zuzanna Opała added a comment - Exact place: In template /sio2/oioioi/oioioi/forum/templates/forum/category.html, error at line 66: 65 <small> 66 {% full_name t.last_post.author as author_link %} 67 {% blocktrans with date=t.last_post.add_date author=author_link last_id=t.last_post.id %} 68 <a href="{{ thread_link }}#forum-post-{{ last_id }}">{{ date }}</a>, by {{ author }} 69 {% endblocktrans %} 70 </small>
        Hide
        Gerrit Gerrit added a comment -
        Change oioioi~master~I7bf5464bba04d765d77e6196ef518240e802364f, patchset 1
        https://gerrit.sio2project.mimuw.edu.pl/3126

        SIO-2128 Fix category view when thread is empty

        Now the last post filed is empty in this case.

        Change-Id: I7bf5464bba04d765d77e6196ef518240e802364f
        Show
        Gerrit Gerrit added a comment - Change oioioi~master~I7bf5464bba04d765d77e6196ef518240e802364f, patchset 1 https://gerrit.sio2project.mimuw.edu.pl/3126 SIO-2128 Fix category view when thread is empty Now the last post filed is empty in this case. Change-Id: I7bf5464bba04d765d77e6196ef518240e802364f
        Hide
        Gerrit Gerrit added a comment -
        Change oioioi~master~I7bf5464bba04d765d77e6196ef518240e802364f, patchset 2
        https://gerrit.sio2project.mimuw.edu.pl/3126

        SIO-2128 Fix category view when thread is empty

        Now the last post filed is empty in this case.

        Change-Id: I7bf5464bba04d765d77e6196ef518240e802364f
        Show
        Gerrit Gerrit added a comment - Change oioioi~master~I7bf5464bba04d765d77e6196ef518240e802364f, patchset 2 https://gerrit.sio2project.mimuw.edu.pl/3126 SIO-2128 Fix category view when thread is empty Now the last post filed is empty in this case. Change-Id: I7bf5464bba04d765d77e6196ef518240e802364f

          People

          • Assignee:
            Szymon Acedański
            Reporter:
            Zuzanna Opała
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: