aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-02-27 09:56:56 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2013-02-27 09:56:56 -0600
commitaecd65b789c1c6094a6bf5d8c75987675fd9e4f3 (patch)
tree8114919073ab56f0311a8325c5001bd95fb58106
parent8db7eed3bcba5c0527befc48a9d2b84cf5be62a8 (diff)
downloadmediagoblin-aecd65b789c1c6094a6bf5d8c75987675fd9e4f3.tar.lz
mediagoblin-aecd65b789c1c6094a6bf5d8c75987675fd9e4f3.tar.xz
mediagoblin-aecd65b789c1c6094a6bf5d8c75987675fd9e4f3.zip
Simplifying the test for whether or not a user and slug combo exists.
Thanks to tchernobog for catching this (it was breaking on postgres) and Elrond for the suggestion on how to fix it. This commit sponsored by Caleb Cooper. Thanks Caleb!
-rw-r--r--mediagoblin/db/migrations.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index e9b4e9ef..167c4f87 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -215,12 +215,10 @@ def mediaentry_new_slug_era(db):
import uuid
def slug_and_user_combo_exists(slug, uploader):
- # Technically returns the number of entries with this slug and user
- # that already exist
return db.execute(
media_table.select(
and_(media_table.c.uploader==uploader,
- media_table.c.slug==slug)).count()).first().tbl_row_count
+ media_table.c.slug==slug))).first() is not None
def append_garbage_till_unique(row, new_slug):
"""