Fix for mongo.
pymongo does not rewind a cursor after leaving a for loop. So let us do it by hand. Well.
This commit is contained in:
parent
1eff10fa0f
commit
d8409c26a0
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user