﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	parents
5415	Server error when trying to access media with graveyards comments	ayleph		"As a logged in user, if I try to access a media page with a graveyard comment, I get a server error with the text below in my log. If I'm not logged in, then the comments aren't displayed, so the error doesn't occur.

{{{
Error - <class 'jinja2.exceptions.UndefinedError'>: 'mediagoblin.db.models.Graveyard object' has no attribute 'get_actor'
URL: https://goblinrefuge.com/mediagoblin/u/sushibsd/m/dank-wats/
File '/path/to/mediagoblin/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/exceptions/errormiddleware.py', line 144 in __call__
  app_iter = self.application(environ, sr_checker)
File '/path/to/mediagoblin/mediagoblin/app.py', line 342 in __call__
  return self.call_backend(environ, start_response)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Werkzeug-0.10.1-py2.7.egg/werkzeug/wsgi.py', line 591 in __call__
  return self.app(environ, start_response)
File '/path/to/mediagoblin/mediagoblin/app.py', line 276 in call_backend
  return self._finish_call_backend(request, environ, start_response)
File '/path/to/mediagoblin/mediagoblin/app.py', line 318 in _finish_call_backend
  response = controller(request)
File '/path/to/mediagoblin/mediagoblin/decorators.py', line 47 in wrapper
  return controller(request, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/decorators.py', line 210 in wrapper
  return controller(request, media=media, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/decorators.py', line 170 in wrapper
  return controller(request, page=page, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/user_pages/views.py', line 170 in media_home
  context)
File '/path/to/mediagoblin/mediagoblin/tools/response.py', line 36 in render_to_response
  render_template(request, template, context),
File '/path/to/mediagoblin/mediagoblin/tools/template.py', line 144 in render_template
  rendered = template.render(context)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Jinja2-2.7.3-py2.7.egg/jinja2/environment.py', line 969 in render
  return self.environment.handle_exception(exc_info, True)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Jinja2-2.7.3-py2.7.egg/jinja2/environment.py', line 742 in handle_exception
  reraise(exc_type, exc_value, tb)
File '/path/to/mediagoblin/mediagoblin/templates/mediagoblin/media_displays/video.html', line 19 in top-level template code 
  {% extends 'mediagoblin/user_pages/media.html' %}
File '/path/to/mediagoblin/mediagoblin/templates/mediagoblin/user_pages/media.html', line 21 in top-level template code 
  {% from ""mediagoblin/utils/pagination.html"" import render_pagination %}
File '/var/lib/mediagoblin/templates/mediagoblin/base.html', line 64 in top-level template code 
  {% block mediagoblin_body %}
File '/var/lib/mediagoblin/templates/mediagoblin/base.html', line 203 in block ""mediagoblin_body""
  {% block mediagoblin_content %}
File '/path/to/mediagoblin/mediagoblin/templates/mediagoblin/user_pages/media.html', line 136 in block ""mediagoblin_content""
  <a href=""{{ request.urlgen('mediagoblin.user_pages.user_home',
File '/path/to/mediagoblin/lib/python2.7/site-packages/Jinja2-2.7.3-py2.7.egg/jinja2/environment.py', line 397 in getattr
  return getattr(obj, attribute)
UndefinedError: 'mediagoblin.db.models.Graveyard object' has no attribute 'get_actor'
}}}

The problematic code is in `mediagoblin/templates/mediagoblin/user_pages/media.html`.

{{{
      {% for comment in comments %}
        {% set comment_author = comment.get_actor %}
        <li id=""comment-{{ comment.id }}""
          {%- if pagination.active_id == comment.id %}
            class=""comment_wrapper comment_active"">
            <a name=""comment"" id=""comment""></a>
          {%- else %}
            class=""comment_wrapper"">
          {%- endif %}
          <div class=""comment_author"">
            <img src=""{{ request.staticdirect('/images/icon_comment.png') }}"" />
            <a href=""{{ request.urlgen('mediagoblin.user_pages.user_home',
                            user=comment_author.username) }}""
               class=""comment_authorlink"">
              {{- comment_author.username -}}
            </a>
            <a href=""{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
                            comment=comment.id,
                            user=media.get_actor.username,
                            media=media.slug_or_id) }}#comment""
               class=""comment_whenlink"">
              <span title='{{- comment.created.strftime(""%I:%M%p %Y-%m-%d"") -}}'>
                {%- trans formatted_time=timesince(comment.created) -%}
                  {{ formatted_time }} ago
                {%- endtrans -%}
              </span></a>:
          </div>
}}}

`comment in comments` appears to return graveyard comments as well, and these comments don't have a `get_actor` attribute."	defect	closed	blocker	0.9.0	programming	fixed	graveyard,comments	tsyesika	
