aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/listings
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-03-16 20:59:44 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2012-03-16 21:20:14 +0100
commitd8409c26a0bf40b336e036aecf3224aa74f5b8f3 (patch)
treeef71b2be3ddd917667055442a50f0ac9e1ba60bc /mediagoblin/listings
parent1eff10fa0fbb93bf5669bbd09cb6e2ac6ad24813 (diff)
downloadmediagoblin-d8409c26a0bf40b336e036aecf3224aa74f5b8f3.tar.lz
mediagoblin-d8409c26a0bf40b336e036aecf3224aa74f5b8f3.tar.xz
mediagoblin-d8409c26a0bf40b336e036aecf3224aa74f5b8f3.zip
Fix for mongo.
pymongo does not rewind a cursor after leaving a for loop. So let us do it by hand. Well.
Diffstat (limited to 'mediagoblin/listings')
-rw-r--r--mediagoblin/listings/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mediagoblin/listings/views.py b/mediagoblin/listings/views.py
index d96b9606..5c365ed2 100644
--- a/mediagoblin/listings/views.py
+++ b/mediagoblin/listings/views.py
@@ -29,13 +29,16 @@ def _get_tag_name_from_entries(media_entries, tag_slug):
"""
# ... this is slightly hacky looking :\
tag_name = tag_slug
- # if media_entries.count():
+
for entry in media_entries:
for tag in entry.tags:
if tag['slug'] == tag_slug:
tag_name = tag['name']
break
break
+ # TODO: Remove after SQL-switch, it's mongo specific
+ if hasattr(media_entries, "rewind"):
+ media_entries.rewind()
return tag_name