From 0c871f81220b3d5c1700a0e4141eb7e52efc04e0 Mon Sep 17 00:00:00 2001 From: Elrond Date: Tue, 22 Jan 2013 22:28:19 +0100 Subject: [PATCH] Use inspect_table; default user license==None. Use inspect_table in the new migration. Makes code more readable, really. And make the default for the preferred license be None. This is a userspace thing, so we can even change the migration here. Changing the migration means, that people running the migration before this commit get a "" in User.license_preference, while people running the migration now get a None. Both values are okay. None has been designated as "Use the site's default". We're not actually having a site default right now. Which means no license is selected in the dropdown. While "" means "All rights reserved" being chosen by the user. Side note: Having no license being selected in the submit dropdown is as "worse" as before and does not really hurt much. MediaEntry.license==None means "All rights reserved" as does "" also do. --- mediagoblin/db/migrations.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 3f43c789..b25d577d 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -190,9 +190,8 @@ def fix_CollectionItem_v0_constraint(db_conn): def add_license_preference(db): metadata = MetaData(bind=db.bind) - user_table = Table('core__users', metadata, autoload=True, - autoload_with=db.bind) + user_table = inspect_table(metadata, 'core__users') - col = Column('license_preference', Unicode, default=u'') + col = Column('license_preference', Unicode) col.create(user_table) db.commit()