From 4fc8ed8e7a00be118d7a9faa3d05d54d27e7ae21 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Mon, 20 Oct 2014 14:34:33 -0400 Subject: [PATCH] Fix command line migrator --- .../contentstore/management/commands/migrate_to_split.py | 2 +- common/lib/xmodule/xmodule/modulestore/split_migrator.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/management/commands/migrate_to_split.py b/cms/djangoapps/contentstore/management/commands/migrate_to_split.py index bb164fc6d8..28ee065ce4 100644 --- a/cms/djangoapps/contentstore/management/commands/migrate_to_split.py +++ b/cms/djangoapps/contentstore/management/commands/migrate_to_split.py @@ -63,7 +63,7 @@ class Command(BaseCommand): except IndexError: pass - return course_key, user, org, course, run + return course_key, user.id, org, course, run def handle(self, *args, **options): course_key, user, org, course, run = self.parse_args(*args) diff --git a/common/lib/xmodule/xmodule/modulestore/split_migrator.py b/common/lib/xmodule/xmodule/modulestore/split_migrator.py index e7b1b63c7f..8788e0679d 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_migrator.py +++ b/common/lib/xmodule/xmodule/modulestore/split_migrator.py @@ -11,6 +11,7 @@ import logging from xblock.fields import Reference, ReferenceList, ReferenceValueDict from xmodule.modulestore import ModuleStoreEnum from opaque_keys.edx.locator import CourseLocator +from xmodule.modulestore.exceptions import ItemNotFoundError log = logging.getLogger(__name__) @@ -46,6 +47,8 @@ class SplitMigrator(object): # create the course: set fields to explicitly_set for each scope, id_root = new_course_locator, master_branch = 'production' original_course = self.source_modulestore.get_course(source_course_key, **kwargs) + if original_course is None: + raise ItemNotFoundError(unicode(source_course_key)) if new_org is None: new_org = source_course_key.org