aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-10-20 12:24:54 +0000
committerJessica Tallon <tsyesika@tsyesika.se>2015-10-20 12:24:54 +0000
commit64a456a4e50b03e4fa2b33ceb208e88d2e02fce7 (patch)
treef60658eb937886dfd1cc349cab605c13a02942e5 /mediagoblin/decorators.py
parentfd703bb4d0665958d853b89f6069eefd8a8c8113 (diff)
downloadmediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.tar.lz
mediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.tar.xz
mediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.zip
Comment changes for federation
This adds a new Comment link table that is used to link between some object and then the comment object, which can be more or less any object in Mediagoblin. The MediaComment has been renamed to TextComment as that more aptly describes what it is. There is migrations for these changes. There is also the conslidation of the Report tables into a single Report table, the same with the Notification objects. This is because both of them split out MediaEntry and Comment versions into their own polymorphic versions from a base, this is no longer a meaningful distinction as comments can be anything.
Diffstat (limited to 'mediagoblin/decorators.py')
-rw-r--r--mediagoblin/decorators.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index 8874d2a0..a2c49bcc 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -23,7 +23,8 @@ from six.moves.urllib.parse import urljoin
from mediagoblin import mg_globals as mgg
from mediagoblin import messages
-from mediagoblin.db.models import MediaEntry, LocalUser, MediaComment, AccessToken
+from mediagoblin.db.models import MediaEntry, LocalUser, TextComment, \
+ AccessToken, Comment
from mediagoblin.tools.response import (
redirect, render_404,
render_user_banned, json_response)
@@ -325,11 +326,11 @@ def allow_reporting(controller):
def get_optional_media_comment_by_id(controller):
"""
- Pass in a MediaComment based off of a url component. Because of this decor-
- -ator's use in filing Media or Comment Reports, it has two valid outcomes.
+ Pass in a Comment based off of a url component. Because of this decor-
+ -ator's use in filing Reports, it has two valid outcomes.
:returns The view function being wrapped with kwarg `comment` set to
- the MediaComment who's id is in the URL. If there is a
+ the Comment who's id is in the URL. If there is a
comment id in the URL and if it is valid.
:returns The view function being wrapped with kwarg `comment` set to
None. If there is no comment id in the URL.
@@ -339,8 +340,9 @@ def get_optional_media_comment_by_id(controller):
@wraps(controller)
def wrapper(request, *args, **kwargs):
if 'comment' in request.matchdict:
- comment = MediaComment.query.filter_by(
- id=request.matchdict['comment']).first()
+ comment = Comment.query.filter_by(
+ id=request.matchdict['comment']
+ ).first()
if comment is None:
return render_404(request)