aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages
diff options
context:
space:
mode:
authorChris Moylan <chris@chrismoylan.com>2011-07-10 22:45:52 -0500
committerChris Moylan <chris@chrismoylan.com>2011-07-10 22:45:52 -0500
commit3d073d48cbf797c3da7b19670b8696d2229cce9b (patch)
treeff32c6b125ccf791d2adc70064d2f7bc7ae6ef3b /mediagoblin/user_pages
parent9df37e8a4a9387e9ebe6690d0f18b94a31d7ae4d (diff)
parent3054e2b3cb08839aca7da2e1c5b4cce1768bf705 (diff)
downloadmediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.tar.lz
mediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.tar.xz
mediagoblin-3d073d48cbf797c3da7b19670b8696d2229cce9b.zip
Merge branch 'master' into test_submission_views_365
Diffstat (limited to 'mediagoblin/user_pages')
-rw-r--r--mediagoblin/user_pages/forms.py43
-rw-r--r--mediagoblin/user_pages/routing.py3
-rw-r--r--mediagoblin/user_pages/views.py10
3 files changed, 33 insertions, 23 deletions
diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py
index 9f7d2fbd..8829b674 100644
--- a/mediagoblin/user_pages/forms.py
+++ b/mediagoblin/user_pages/forms.py
@@ -1,21 +1,22 @@
-# GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 Free Software Foundation, Inc
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import wtforms
-
-class MediaCommentForm(wtforms.Form):
- comment = wtforms.TextAreaField('Comment',
- [wtforms.validators.Required()]) \ No newline at end of file
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import wtforms
+
+class MediaCommentForm(wtforms.Form):
+ comment_content = wtforms.TextAreaField(
+ 'Comment',
+ [wtforms.validators.Required()])
diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py
index 255b6f66..3be0617d 100644
--- a/mediagoblin/user_pages/routing.py
+++ b/mediagoblin/user_pages/routing.py
@@ -24,6 +24,9 @@ user_routes = [
Route('mediagoblin.user_pages.media_home', '/{user}/m/{media}/',
requirements=dict(m_id="[0-9a-fA-F]{24}"),
controller="mediagoblin.user_pages.views:media_home"),
+ Route('mediagoblin.user_pages.media_home.view_comment',
+ '/{user}/m/{media}/c/{comment}/',
+ controller="mediagoblin.user_pages.views:media_home"),
Route('mediagoblin.edit.edit_media', "/{user}/m/{media}/edit/",
controller="mediagoblin.edit.views:edit_media"),
Route('mediagoblin.user_pages.atom_feed', '/{user}/atom/',
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 3a8684d3..a3172ebd 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -95,8 +95,14 @@ def media_home(request, media, page, **kwargs):
"""
'Homepage' of a MediaEntry()
"""
+ if ObjectId(request.matchdict.get('comment')):
+ pagination = Pagination(
+ page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE,
+ ObjectId(request.matchdict.get('comment')))
+ else:
+ pagination = Pagination(
+ page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
- pagination = Pagination(page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
comments = pagination()
comment_form = user_forms.MediaCommentForm(request.POST)
@@ -118,7 +124,7 @@ def media_post_comment(request):
comment = request.db.MediaComment()
comment['media_entry'] = ObjectId(request.matchdict['media'])
comment['author'] = request.user['_id']
- comment['content'] = request.POST['comment']
+ comment['content'] = request.POST['comment_content']
comment['content_html'] = cleaned_markdown_conversion(comment['content'])