Repository navigation
Fix keyerror #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix keyerror #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| VERSION = (0, 9, 5) | ||
| VERSION = (0, 9, 6) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,11 +102,10 @@ def make_request(self, path, params=None, data=None, method=None): | |
| cleaned_data = data.copy() | ||
| try: | ||
| del cleaned_data['subscription[ccCardCode]'] | ||
| ccNum = cleaned_data['subscription[ccNumber]'] | ||
| cleaned_data['subscription[ccNumber]'] = ccNum[-4:] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is generally bad form to use exceptions for flow control. You should instead do:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trust me, I'm not considering keeping this band-aid around. I'll keep these in mind next time I run into these cases. |
||
| except KeyError: | ||
| pass | ||
| ccNum = cleaned_data['subscription[ccNumber]'] | ||
| cleaned_data['subscription[ccNumber]'] = ccNum[-4:] | ||
|
|
||
| cleaned_data['subscription[ccNumber]'] = None | ||
|
|
||
| client_log.debug('Request Method: %s' % method) | ||
| client_log.debug('Request Body (Cleaned Data): %s' % cleaned_data) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, you can use
cleaned_data.pop('subscription[ccCardCode]')which will remove the value without a KeyError.