Commit 4f49ddbd by ichuang

re-add import git info after importing

parent be0ab928
......@@ -1289,6 +1289,18 @@ def import_course(request, org, course, name):
module_store, course_items = import_from_xml(modulestore('direct'), settings.GITHUB_REPO_ROOT,
[local_dir], load_error_modules=False, static_content_store=contentstore(), target_location_namespace = Location(location))
# update metadata with github import info
course_module = modulestore().get_item(location)
metadata = course_module.metadata
if 'import' not in metadata:
metadata['import'] = {}
importinfo = metadata['import']
importinfo['local_dir'] = local_dir
importinfo['git_repo'] = git_repo
importinfo['git_branch'] = git_branch
store = get_modulestore(Location(location));
store.update_metadata(location, course_module.metadata) # save in mongodb store
# grab error log from import and show that?
message += 'Import done.'
......
......@@ -127,7 +127,7 @@ def import_from_xml(store, data_dir, course_dirs=None,
course_location = module.location
if static_content_store is not None:
_namespace_rename = target_location_namespace if target_location_namespace is not None else module_store.modules[course_id].location
_namespace_rename = target_location_namespace if target_location_namespace is not None else course_location # module_store.modules[course_id].location
# first pass to find everything in /static/
import_static_content(module_store.modules[course_id], course_location, course_data_path, static_content_store,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment