From: Aaron Williamson Date: Tue, 17 Jan 2012 06:22:02 +0000 (-0500) Subject: Fixed a syntax error in edit/views and added back in some missing license stuff from... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a6c49d49dc1c15aedfdd7bc63a7b191ecb827787;p=mediagoblin.git Fixed a syntax error in edit/views and added back in some missing license stuff from models --- 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,