From a6c49d49dc1c15aedfdd7bc63a7b191ecb827787 Mon Sep 17 00:00:00 2001 From: Aaron Williamson Date: Tue, 17 Jan 2012 01:22:02 -0500 Subject: [PATCH] Fixed a syntax error in edit/views and added back in some missing license stuff from models --- mediagoblin/db/mongo/models.py | 9 ++++++++- mediagoblin/edit/views.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mediagoblin/db/mongo/models.py b/mediagoblin/db/mongo/models.py index 906d2849..a95cde7d 100644 --- a/mediagoblin/db/mongo/models.py +++ b/mediagoblin/db/mongo/models.py @@ -22,7 +22,7 @@ from mediagoblin import mg_globals from mediagoblin.db.mongo import migrations from mediagoblin.db.mongo.util import ASCENDING, DESCENDING, ObjectId from mediagoblin.tools.pagination import Pagination -from mediagoblin.tools import url +from mediagoblin.tools import url, licenses from mediagoblin.db.mixin import UserMixin, MediaEntryMixin ################### @@ -151,6 +151,8 @@ class MediaEntry(Document, MediaEntryMixin): "unprocessed": uploaded but needs to go through processing for display "processed": processed and able to be displayed + - license: URI for media's license. + - queued_media_file: storage interface style filepath describing a file queued for processing. This is stored in the mg_globals.queue_store storage system. @@ -183,6 +185,7 @@ class MediaEntry(Document, MediaEntryMixin): 'plugin_data': dict, # plugins can dump stuff here. 'tags': [dict], 'state': unicode, + 'license': unicode, # For now let's assume there can only be one main file queued # at a time @@ -249,6 +252,10 @@ class MediaEntry(Document, MediaEntryMixin): for media in cursor: return media.url_for_self(urlgen) + def get_license_data(self): + """Return license dict for requested license""" + return licenses.SUPPORTED_LICENSES[self['license']] + @property def get_uploader(self): return self.db.User.find_one({'_id': self.uploader}) diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 6f4585cf..a3b269d8 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -47,8 +47,8 @@ def edit_media(request, media): title=media.title, slug=media.slug, description=media.description, - tags=media_tags_as_string(media.tags)) - license=media.license) + tags=media_tags_as_string(media.tags), + license=media.license)) form = forms.EditForm( request.POST, -- 2.25.1