From: Elrond Date: Sat, 24 Mar 2012 09:55:34 +0000 (+0100) Subject: Cleanup mongo->sql converter. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e63656fcf74ac0b6f7de3922e60481f7dfc21c7c;p=mediagoblin.git Cleanup mongo->sql converter. 1. No need to drop media_data['exif'], we only have and want media_data['exif_all']. 2. Use media['_id'] instead of media._id (better not use dot-notation on mongo objects in such a low level tool). --- diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py index 232e424f..ebf3037c 100644 --- a/mediagoblin/db/sql/convert.py +++ b/mediagoblin/db/sql/convert.py @@ -115,12 +115,9 @@ def convert_image(mk_db): {'media_type': 'mediagoblin.media_types.image'}).sort('created'): media_data = copy(media.media_data) - # TODO: Fix after exif is migrated - media_data.pop('exif', None) - if len(media_data): media_data_row = ImageData(**media_data) - media_data_row.media_entry = obj_id_table[media._id] + media_data_row.media_entry = obj_id_table[media['_id']] session.add(media_data_row) session.commit() @@ -133,7 +130,7 @@ def convert_video(mk_db): for media in mk_db.MediaEntry.find( {'media_type': 'mediagoblin.media_types.video'}).sort('created'): media_data_row = VideoData(**media.media_data) - media_data_row.media_entry = obj_id_table[media._id] + media_data_row.media_entry = obj_id_table[media['_id']] session.add(media_data_row) session.commit()