diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2015-10-20 13:02:15 +0000 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2015-10-20 13:02:15 +0000 |
commit | 03bb1b7907d2d0fa522bf4705e4891494839da09 (patch) | |
tree | f60658eb937886dfd1cc349cab605c13a02942e5 /mediagoblin/decorators.py | |
parent | fd703bb4d0665958d853b89f6069eefd8a8c8113 (diff) | |
parent | 64a456a4e50b03e4fa2b33ceb208e88d2e02fce7 (diff) | |
download | mediagoblin-03bb1b7907d2d0fa522bf4705e4891494839da09.tar.lz mediagoblin-03bb1b7907d2d0fa522bf4705e4891494839da09.tar.xz mediagoblin-03bb1b7907d2d0fa522bf4705e4891494839da09.zip |
Merge branch 'comments'
Diffstat (limited to 'mediagoblin/decorators.py')
-rw-r--r-- | mediagoblin/decorators.py | 14 |
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) |