License "all rights reserved" default should be None/NULL, not empty string
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 21 Jan 2012 22:40:39 +0000 (16:40 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 21 Jan 2012 22:40:39 +0000 (16:40 -0600)
mediagoblin/db/mixin.py
mediagoblin/db/mongo/migrations.py
mediagoblin/db/sql/models.py
mediagoblin/edit/views.py
mediagoblin/submit/views.py

index b0fecad3f31a41009df13f50778e19e1d6059932..d587ccb42978f0daaecea8039a12462ae96240f5 100644 (file)
@@ -93,4 +93,4 @@ class MediaEntryMixin(object):
 
     def get_license_data(self):
         """Return license dict for requested license"""
-        return licenses.SUPPORTED_LICENSES[self.license]
+        return licenses.SUPPORTED_LICENSES[self.license or ""]
index f66ade2b3302bf314e41e454d267f49e490cc8aa..168fa53052ed97343c7becea06236c285482efea 100644 (file)
@@ -114,4 +114,4 @@ def mediaentry_add_license(database):
     """
     Add the 'license' field for entries that don't have it.
     """
-    add_table_field(database, 'media_entries', 'license', '')
+    add_table_field(database, 'media_entries', 'license', None)
index 53ac3d3f51e14dd71f4d8da4a2cc06d083fe45d9..507efe622dec4d57add69acd7beca9c3ba826f12 100644 (file)
@@ -81,7 +81,7 @@ class MediaEntry(Base, MediaEntryMixin):
     description_html = Column(UnicodeText) # ??
     media_type = Column(Unicode, nullable=False)
     state = Column(Unicode, nullable=False) # or use sqlalchemy.types.Enum?
-    license = Column(Unicode, nullable=False)
+    license = Column(Unicode)
 
     fail_error = Column(Unicode)
     fail_metadata = Column(UnicodeText)
index 62684dcf6cbc9982ca13e3cac37d9e88308bd1fe..471968f748324a06021eba67cbfa938c40754b68 100644 (file)
@@ -75,7 +75,7 @@ def edit_media(request, media):
             media.description_html = cleaned_markdown_conversion(
                 media.description)
 
-            media.license = unicode(request.POST.get('license', ''))
+            media.license = unicode(request.POST.get('license')) or None
 
             media.slug = unicode(request.POST['slug'])
 
index 832203a49103753f40eaa253104b8573be9dd659..f70e4ba5ffff7ef8eb9321ef82beba69ad841c5f 100644 (file)
@@ -69,7 +69,7 @@ def submit_start(request):
                 entry.description_html = cleaned_markdown_conversion(
                     entry.description)
 
-                entry.license = unicode(request.POST.get('license', ''))
+                entry.license = unicode(request.POST.get('license', "")) or None
 
                 entry.uploader = request.user._id