aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--docs/source/deploying.rst2
-rw-r--r--mediagoblin/config_spec.ini3
-rw-r--r--mediagoblin/db/models.py9
-rw-r--r--mediagoblin/user_pages/views.py8
5 files changed, 19 insertions, 5 deletions
diff --git a/AUTHORS b/AUTHORS
index c9fc5c8e..76e16b86 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,6 +13,7 @@ Thank you!
* Alex Camelio
* Bernhard Keller
* Caleb Forbes Davis V
+* Corey Farwell
* Chris Moylan
* Christopher Allan Webber
* Daniel Neel
@@ -27,6 +28,7 @@ Thank you!
* Nathan Yergler
* Odin Hørthe Omdal
* Osama Khalid
+* Pablo J. Urbano Santos
* Rasmus Larsson
* Sam Kleinman
* Sebastian Spaeth
diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst
index c2ba0c47..b944a3d3 100644
--- a/docs/source/deploying.rst
+++ b/docs/source/deploying.rst
@@ -207,7 +207,7 @@ this ``nginx.conf`` file should be modeled on the following: ::
# Instance specific media:
location /mgoblin_media/ {
- alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/user_dev/media/public/;
+ alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Mounting MediaGoblin itself via fastcgi.
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index b804358c..eef6f6e0 100644
--- a/mediagoblin/config_spec.ini
+++ b/mediagoblin/config_spec.ini
@@ -30,6 +30,9 @@ allow_registration = boolean(default=True)
tags_delimiter = string(default=",")
tags_max_length = integer(default=50)
+# Whether comments are ascending or descending
+comments_ascending = boolean(default=True)
+
# By default not set, but you might want something like:
# "%(here)s/user_dev/templates/"
local_templates = string()
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 1c1bc2fd..f13a4457 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -217,9 +217,14 @@ class MediaEntry(Document):
'created': datetime.datetime.utcnow,
'state': u'unprocessed'}
- def get_comments(self):
+ def get_comments(self, ascending=False):
+ if ascending:
+ order = ASCENDING
+ else:
+ order = DESCENDING
+
return self.db.MediaComment.find({
- 'media_entry': self._id}).sort('created', DESCENDING)
+ 'media_entry': self._id}).sort('created', order)
def get_display_media(self, media_map,
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 82865bb4..25fd2ebb 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -106,11 +106,15 @@ def media_home(request, media, page, **kwargs):
"""
if ObjectId(request.matchdict.get('comment')):
pagination = Pagination(
- page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE,
+ page, media.get_comments(
+ mg_globals.app_config['comments_ascending']),
+ MEDIA_COMMENTS_PER_PAGE,
ObjectId(request.matchdict.get('comment')))
else:
pagination = Pagination(
- page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
+ page, media.get_comments(
+ mg_globals.app_config['comments_ascending']),
+ MEDIA_COMMENTS_PER_PAGE)
comments = pagination()