From 8eb216388f0999115d68c33e2fe2460bc9986112 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Thu, 15 Dec 2011 23:49:52 +0100 Subject: [PATCH] Fixed import_export - Mongokit instead of pymongo - db.MediaEntry instead of db.media_entry (pymongo style) --- mediagoblin/gmg_commands/import_export.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 1308f09e..eda41f4c 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -64,7 +64,7 @@ def _import_media(db, args): queue_cache = BasicFileStorage( args._cache_path['queue']) - for entry in db.media_entries.find(): + for entry in db.MediaEntry.find(): for name, path in entry['media_files'].items(): _log.info('Importing: {0} - {1}'.format( entry.title, @@ -107,7 +107,7 @@ def env_import(args): global_config, app_config = setup_global_and_app_config(args.conf_file) connection, db = setup_connection_and_db_from_config( - app_config, use_pymongo=True) + app_config) tf = tarfile.open( args.tar_file, @@ -206,7 +206,7 @@ def _export_media(db, args): queue_cache = BasicFileStorage( args._cache_path['queue']) - for entry in db.media_entries.find(): + for entry in db.MediaEntry.find(): for name, path in entry['media_files'].items(): _log.info(u'Exporting {0} - {1}'.format( entry.title, @@ -215,7 +215,7 @@ def _export_media(db, args): mc_file = media_cache.get_file(path, mode='wb') mc_file.write( mg_globals.public_store.get_file(path, mode='rb').read()) - except e: + except Exception as e: _log.error('Failed: {0}'.format(e)) _log.info('...Media exported') @@ -246,7 +246,7 @@ def env_export(args): setup_storage() connection, db = setup_connection_and_db_from_config( - app_config, use_pymongo=True) + app_config) _export_database(db, args) -- 2.25.1