From 455fd36ff66746aecd66095080ae00a547337a8c Mon Sep 17 00:00:00 2001 From: Elrond Date: Fri, 25 Jan 2013 22:41:28 +0100 Subject: Use GenerateSlugMixin for collections. Use the new way of generating slugs also for collections. Also drop the dummy_db arg to check_collection_slug_used. --- mediagoblin/db/mixin.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'mediagoblin/db/mixin.py') diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py index a55a1905..f2c2932c 100644 --- a/mediagoblin/db/mixin.py +++ b/mediagoblin/db/mixin.py @@ -242,22 +242,13 @@ class MediaCommentMixin(object): return cleaned_markdown_conversion(self.content) -class CollectionMixin(object): - def generate_slug(self): +class CollectionMixin(GenerateSlugMixin): + def check_slug_used(self, slug): # import this here due to a cyclic import issue # (db.models -> db.mixin -> db.util -> db.models) from mediagoblin.db.util import check_collection_slug_used - self.slug = slugify(self.title) - - duplicate = check_collection_slug_used(mg_globals.database, - self.creator, self.slug, self.id) - - if duplicate: - if self.id is not None: - self.slug = u"%s-%s" % (self.id, self.slug) - else: - self.slug = None + return check_collection_slug_used(self.creator, slug, self.id) @property def description_html(self): -- cgit v1.2.3