Skip to content
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

Refactored code to avoid a deprecation warning in Python 2.7 #41

Merged
merged 2 commits into from
Apr 16, 2013
Merged

Refactored code to avoid a deprecation warning in Python 2.7 #41

merged 2 commits into from
Apr 16, 2013

Conversation

epicserve
Copy link
Contributor

No description provided.

try:
data["error"] = e.args[0]
except IndexError:
data["error"] = "Unknown error"
Copy link
Member

Choose a reason for hiding this comment

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

This block of code is unreachable due to the 'raise' on line 148 as reported by Travis

************* Module payments.views
W0101:148,12:subscribe: Unreachable code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooops. If I'm correct you don't need line 147. Does that seem right to you?

Copy link
Member

Choose a reason for hiding this comment

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

Yes in order to render the form errors, if there are any.

Copy link
Member

Choose a reason for hiding this comment

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

so stripe.StripeError no longer as a message attribute?

@epicserve
Copy link
Contributor Author

Without this fix you get the following in the terminal runserver:

/path/to/venv/django-stripe-payments/src/django-stripe-payments/payments/views.py:148: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

data["error"] = e.message

With this fix you don't get the DeprecationWarning, but you still get the error in the subscribe view. Just like my attached screenshot.

Screen Shot 2013-04-15 at 6 03 26 PM

paltman added a commit that referenced this pull request Apr 16, 2013
Refactored code to avoid a deprecation warning in Python 2.7
@paltman paltman merged commit 1a49221 into pinax:master Apr 16, 2013
ticosax added a commit to ticosax/pinax-stripe that referenced this pull request Oct 27, 2017
We probably need to pass the stripe account
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.

None yet

2 participants