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!
This commit is contained in:
Christopher Allan Webber 2013-02-27 09:56:56 -06:00
parent 8db7eed3bc
commit aecd65b789

View File

@ -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):
"""