Implement licenses.get_license_by_url

Rather than exploding in the user's face (for example if we custom-configure
licenses in our MG instance, and there are still media with now "unknown"
licenses in the db), simply return a License object as a fallback, where all
attributes are set to the URL we were handed.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth
2012-11-26 14:55:33 +01:00
parent 8e5fae9b43
commit 138a18fd6e
2 changed files with 11 additions and 1 deletions

View File

@@ -139,7 +139,7 @@ class MediaEntryMixin(object):
def get_license_data(self):
"""Return license dict for requested license"""
return licenses.SUPPORTED_LICENSES[self.license or ""]
return licenses.get_license_by_url(self.license or "")
def exif_display_iter(self):
from mediagoblin.tools.exif import USEFUL_TAGS