aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages/views.py
diff options
context:
space:
mode:
authorBernhard Keller <keller_bernhard@web.de>2011-05-19 17:24:31 +0200
committerBernhard Keller <keller_bernhard@web.de>2011-05-19 17:24:31 +0200
commitca3ca51c5a1fa4c10b88c851c9bd04ae7978cb41 (patch)
tree414b6740013b3f9895802d13f5ef5dbaff74e92d /mediagoblin/user_pages/views.py
parentae85ed0f971147ce7cee9ce02b498f909d21ce79 (diff)
downloadmediagoblin-ca3ca51c5a1fa4c10b88c851c9bd04ae7978cb41.tar.lz
mediagoblin-ca3ca51c5a1fa4c10b88c851c9bd04ae7978cb41.tar.xz
mediagoblin-ca3ca51c5a1fa4c10b88c851c9bd04ae7978cb41.zip
changed some coding styles and changed the interface for pagination from __call__ to the
__init__, also getting a cursor as input, instead of the query details
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r--mediagoblin/user_pages/views.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 55d60c6b..26c67425 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -18,7 +18,8 @@ from webob import Response, exc
from pymongo import DESCENDING
from mongokit import ObjectId
import wtforms
-from ..util import Pagination
+from mediagoblin.util import Pagination
+from pymongo import ASCENDING, DESCENDING
def user_home(request):
"""'Homepage' of a User()"""
@@ -28,12 +29,12 @@ def user_home(request):
if not user:
return exc.HTTPNotFound()
- pagination = Pagination()
- media_entries = pagination(
- { 'per_page': 2,
- 'request': request,
- 'collection':'MediaEntry',
- 'query': { 'uploader':user, 'state':'processed'} } )
+ cursor = request.db.MediaEntry \
+ .find({'uploader': user, 'state': 'processed'}) \
+ .sort('created', DESCENDING)
+
+ pagination = Pagination(2, cursor, request)
+ media_entries = pagination()
#if no data is available, return NotFound
if media_entries == None: