-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
feat(misc): return timezone aware datetime objects #2246
base: master
Are you sure you want to change the base?
Conversation
let http_date_to_dt validate timezone information from the provided http-date and return timezone aware datetime objects remove tests for timezone naive variants amend tests Breaks any application relying on naiveness of datetimes or interpretation in local time. Closes falconry#2182
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2246 +/- ##
===========================================
- Coverage 100.00% 99.97% -0.03%
===========================================
Files 63 63
Lines 6847 6853 +6
Branches 1258 1259 +1
===========================================
+ Hits 6847 6851 +4
- Misses 0 1 +1
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. |
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.
Thanks for the PR!
I've left a couple of comments
@@ -29,7 +29,7 @@ def dst(self, dt): | |||
|
|||
|
|||
def utcnow_naive(): |
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.
could likely rename this function to utcnow or use the one from misc from falcon.util.misc import _utcnow
like in test_middleware.py
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.
Sounds reasonable, will change.
@@ -252,26 +252,15 @@ def test_unset(cookie, samesite='Lax'): | |||
assert not result_unset.cookies['baz'].same_site | |||
|
|||
|
|||
def test_cookie_expires_naive(client): |
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.
If I'm not mistaken it's still allowed to set expire to a naive datetime, so this test should be kept. maybe it needs to be updated to check that expire has a timezone?
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.
According to the RFC 9910 every HTTP-date has to follow the implemented rules. That'S the reason for the deletion for the test. The test fails since, whti the new change, naive dates are no longer allowed.
let http_date_to_dt validate timezone information from the provided http-date and return timezone aware datetime objects remove tests for timezone naive variants
amend tests
Breaks any application relying on naiveness of datetimes or interpretation in local time. Closes #2182
Summary of Changes
Make the function http_date_to_dt validate timezone inforamtion of a http-date and return timezone aware datetime objects.
Related Issues
#2182
Pull Request Checklist
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!
If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.
docs/
.docs/
.versionadded
,versionchanged
, ordeprecated
directives.docs/_newsfragments/
, with the file name format{issue_number}.{fragment_type}.rst
. (Runtowncrier --draft
to ensure it renders correctly.)If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!
PR template inspired by the attrs project.