pass
def generate_slug(self):
- self['slug'] = url.slugify(self.title)
+ self.slug = url.slugify(self.title)
duplicate = mg_globals.database.media_entries.find_one(
- {'slug': self['slug']})
+ {'slug': self.slug})
if duplicate:
- self['slug'] = "%s-%s" % (self._id, self['slug'])
+ self.slug = "%s-%s" % (self._id, self.slug)
def url_for_self(self, urlgen):
"""
return urlgen(
'mediagoblin.user_pages.media_home',
user=uploader.username,
- media=self['slug'])
+ media=self.slug)
else:
return urlgen(
'mediagoblin.user_pages.media_home',
if cursor.count():
return urlgen('mediagoblin.user_pages.media_home',
user=self.get_uploader().username,
- media=unicode(cursor[0]['slug']))
+ media=unicode(cursor[0].slug))
def url_to_next(self, urlgen):
"""
if cursor.count():
return urlgen('mediagoblin.user_pages.media_home',
user=self.get_uploader().username,
- media=unicode(cursor[0]['slug']))
+ media=unicode(cursor[0].slug))
def get_uploader(self):
return self.db.User.find_one({'_id': self.uploader})
defaults = dict(
title=media.title,
- slug=media['slug'],
+ slug=media.slug,
description=media['description'],
tags=media_tags_as_string(media['tags']))
media['description_html'] = cleaned_markdown_conversion(
media['description'])
- media['slug'] = unicode(request.POST['slug'])
+ media.slug = unicode(request.POST['slug'])
media.save()
return exc.HTTPFound(