diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index f13a4457..265fe36d 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -263,7 +263,7 @@ class MediaEntry(Document): Use a slug if we have one, else use our '_id'. """ - uploader = self.uploader() + uploader = self.get_uploader() if self.get('slug'): return urlgen( @@ -286,7 +286,7 @@ class MediaEntry(Document): '_id', ASCENDING).limit(1) if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', - user=self.uploader()['username'], + user=self.get_uploader()['username'], media=unicode(cursor[0]['slug'])) def url_to_next(self, urlgen): @@ -300,10 +300,10 @@ class MediaEntry(Document): if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', - user=self.uploader()['username'], + user=self.get_uploader()['username'], media=unicode(cursor[0]['slug'])) - def uploader(self): + def get_uploader(self): return self.db.User.find_one({'_id': self['uploader']}) def get_fail_exception(self): diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index 8f7532ec..1cdce23a 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -58,7 +58,7 @@ def user_may_delete_media(controller): """ def wrapper(request, *args, **kwargs): uploader = request.db.MediaEntry.find_one( - {'_id': ObjectId(request.matchdict['media'])}).uploader() + {'_id': ObjectId(request.matchdict['media'])}).get_uploader() if not (request.user['is_admin'] or request.user._id == uploader._id): return exc.HTTPForbidden() diff --git a/mediagoblin/listings/views.py b/mediagoblin/listings/views.py index 12e539e7..5a09de43 100644 --- a/mediagoblin/listings/views.py +++ b/mediagoblin/listings/views.py @@ -86,7 +86,7 @@ def tag_atom_feed(request): feed.add(entry.get('title'), entry.get('description_html'), content_type='html', - author=entry.uploader()['username'], + author=entry.get_uploader()['username'], updated=entry.get('created'), url=entry.url_for_self(request.urlgen)) diff --git a/mediagoblin/templates/mediagoblin/edit/attachments.html b/mediagoblin/templates/mediagoblin/edit/attachments.html index 576642cf..6a5ab896 100644 --- a/mediagoblin/templates/mediagoblin/edit/attachments.html +++ b/mediagoblin/templates/mediagoblin/edit/attachments.html @@ -20,7 +20,7 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %}