Fix KeyError when saving repository form
Review Request #6746 — Created Jan. 7, 2015 and submitted
A KeyError was raised when certain hosting services (like GitHub) did not contain 'default' as a plan. To fix this, check that 'default' exists in the bug_tracker_forms dictionary before running the remaining validations.
Successfully ran existing scmtools tests. KeyError was no longer raised when a new repository was created.
Description | From | Last Updated |
---|---|---|
To reduce the complexity of the code, try: field = self.bug_tracker_forms[bug_tracker_type].get('default') if field: ... |
chipx86 |
-
Can you add a bit of info to the summary and description? Just something that mentions not all hosts support default field values.
-
The code looks OK, but your summary and description need work. The summary should be something like "Fix KeyError when saving repository form", and the description should explain what the bug was and how your change fixes it.
- Summary:
-
add a check for a 'default' keyFix KeyError when saving repository form
- Description:
-
~ Add a check for a 'default' key
~ A KeyError was raised when certain hosting services (like GitHub) did not contain 'default' as a plan. To fix this, check that 'default' exists in the bug_tracker_forms dictionary before running the remaining validations.
- Change Summary:
-
Simplified if statement
- Commit:
-
2492bdbd48cd1720ab7200c4e3af07a9dfcad2c8009bbc710902dcca647d46d7b229dfd80bfdaea4
- Diff:
-
Revision 2 (+5 -4)