From 25b48323a86a1036112f2f33c889d5d12d5dee9c Mon Sep 17 00:00:00 2001 From: Aaron Williamson Date: Tue, 17 Jan 2012 00:33:55 -0500 Subject: First crack at basic license support. --- mediagoblin/db/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mediagoblin/db/models.py') diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 0f5174cc..e085840e 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -24,6 +24,7 @@ from mediagoblin.db import migrations from mediagoblin.db.util import ASCENDING, DESCENDING, ObjectId from mediagoblin.tools.pagination import Pagination from mediagoblin.tools import url, common +from mediagoblin.tools import licenses ################### # Custom validators @@ -158,6 +159,8 @@ class MediaEntry(Document): "unprocessed": uploaded but needs to go through processing for display "processed": processed and able to be displayed + - license: URI for entry'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. @@ -174,6 +177,7 @@ class MediaEntry(Document): - fail_error: path to the exception raised - fail_metadata: + """ __collection__ = 'media_entries' @@ -189,6 +193,7 @@ class MediaEntry(Document): 'plugin_data': dict, # plugins can dump stuff here. 'tags': [dict], 'state': unicode, + 'license': unicode, # License URI # For now let's assume there can only be one main file queued # at a time @@ -304,6 +309,10 @@ class MediaEntry(Document): if self['fail_error']: return common.import_component(self['fail_error']) + def get_license_data(self): + """Return license dict for requested license""" + return licenses.SUPPORTED_LICENSES[self['license']] + class MediaComment(Document): """ -- cgit v1.2.3