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

Fix two bugs. #207

Merged
merged 1 commit into from
Apr 18, 2018
Merged

Fix two bugs. #207

merged 1 commit into from
Apr 18, 2018

Conversation

ralphbean
Copy link
Contributor

@ralphbean ralphbean commented Apr 17, 2018

First, the value of start could be None here, which causes the error seen in #206. Furthermore, it turns out that the flask module has no BadRequest exception there. It is really in werkzeug.exceptions. Use that.

Lastly, this adds a test, which we really should've added in #197 and really should've added in #204.

First, the value of `start` could be None here, which causes the error seen in #206.
Furthermore, it turns out that the `flask` module has no `BadRequest` exception
there.  It is really in `werkzeug.exceptions`.  Use that.

Lastly, this adds a test, which we really should've added in #197 and *really*
should've added in #204.
if contains and datetime.fromtimestamp(start) < (datetime.utcnow() - timedelta(weeks=4*8)):
raise flask.BadRequest('When using contains, specify a start at most '
'eight months into the past')
if contains and datetime.fromtimestamp(start or 0) < (datetime.utcnow() - timedelta(weeks=4*8)):
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't technically eight months 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"eight months"

@mprahl
Copy link
Contributor

mprahl commented Apr 17, 2018

👍

@ralphbean
Copy link
Contributor Author

Thanks Matt!

@ralphbean ralphbean merged commit 3a34025 into develop Apr 18, 2018
@ralphbean ralphbean deleted the pesky-error-handling branch April 18, 2018 00:03
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