Skip to content

Useless code path in import_from_xml causing errors removed - #4158

Merged
mat-peterson merged 1 commit into
masterfrom
mathewpeterson/course_import_fix
Jun 20, 2014
Merged

Useless code path in import_from_xml causing errors removed#4158
mat-peterson merged 1 commit into
masterfrom
mathewpeterson/course_import_fix

Conversation

@mat-peterson

Copy link
Copy Markdown
Contributor

@dianakhuang @sarina @nasthagiri

It appears as if a useless code path was causing @carsongee errors while importing course from command line.

@carsongee Can you verify that this fixes your issue?

@mat-peterson

Copy link
Copy Markdown
Contributor Author

@carsongee

Copy link
Copy Markdown
Contributor

I just tested that this is allowing imports to occur. I am a little concerned about allowing imports of courses with a different run causing mongo modulestore key issues. Is that all resolved higher up with the opaque keys changes? e.g. Will importing edx/1/Fall and then importing edx/1/Spring create two courses that will then have duplicate shared entries in the Mongo database?

@mat-peterson

Copy link
Copy Markdown
Contributor Author

My understanding is that opaque keys have resolved that higher up. @sarina @dianakhuang Confirm?

@sarina

sarina commented Jun 18, 2014

Copy link
Copy Markdown
Contributor

Eesh that's a better question for @dmitchell or @nasthagiri

@carsongee

Copy link
Copy Markdown
Contributor

https://github.com/edx/edx-platform/pull/3145 is the original PR to which I am concerned about a regression occurring if that helps.

@dmitchell

Copy link
Copy Markdown
Contributor

We moved that defensive code down into the MongoModuleStore which cannot handle the id clash since split and xml don't care. As long as there are no other users of create_new_course which expect it to not overwrite the existing course: 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the semantics of the create_new_course parameter has now changed, you need to update its description in the docstring above. Consider even changing its name to something like create_course_if_not_present.

@mat-peterson

Copy link
Copy Markdown
Contributor Author

I changed create_new_course to create_new_course_if_not_present

@nasthagiri is right about it never reaching the exception so I got rid of it.

@mat-peterson

Copy link
Copy Markdown
Contributor Author

A test failed testing exactly what the exception was intended to do. I'm going to add it back in.

@mat-peterson

Copy link
Copy Markdown
Contributor Author

This latest commit includes the exception.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmprandom Can you update the docstring for this method since the parameter name and semantics have changed? Thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@mat-peterson

Copy link
Copy Markdown
Contributor Author

@dmitchell @nasthagiri All tests have passed! Any concerns?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the docstring to the following:

If True, then a new course is created if it doesn't already exist. The check for existing courses is case-insensitive.

@nasthagiri

Copy link
Copy Markdown
Contributor

👍 once the docstring is updated once more. thanks!

@dmitchell

Copy link
Copy Markdown
Contributor

👍 admitting lack of diligence and hoping not to get bitten

mat-peterson pushed a commit that referenced this pull request Jun 20, 2014
Useless code path in import_from_xml causing errors removed
@mat-peterson
mat-peterson merged commit 8ccd72c into master Jun 20, 2014
@mat-peterson
mat-peterson deleted the mathewpeterson/course_import_fix branch June 20, 2014 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants