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

feat(misc): return timezone aware datetime objects #2246

Merged
merged 13 commits into from
Aug 27, 2024

Conversation

chgad
Copy link
Contributor

@chgad chgad commented Jul 13, 2024

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.

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
    • Added docstrings for any new classes, functions, or modules.
    • Updated docstrings for any modifications to existing code.
    • Updated both WSGI and ASGI docs (where applicable).
    • Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • Updated all relevant supporting documentation files under docs/.
    • A copyright notice is included at the top of any new modules (using your own name or the name of your organization).
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run towncrier --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.

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
@vytas7 vytas7 changed the title feat(misc): Return timezone aware datetime objects feat(misc): return timezone aware datetime objects Jul 13, 2024
Copy link

codecov bot commented Jul 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (321bda1) to head (db6fe41).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2246   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           63        63           
  Lines         7329      7335    +6     
  Branches      1276      1277    +1     
=========================================
+ Hits          7329      7335    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@CaselIT CaselIT left a 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

tests/test_cookies.py Outdated Show resolved Hide resolved
tests/test_cookies.py Outdated Show resolved Hide resolved
CaselIT
CaselIT previously approved these changes Jul 26, 2024
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

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

looks ok to me. Just left a question over abundance of caution.

Thanks for participating to the sprint!

@CaselIT CaselIT requested a review from vytas7 August 8, 2024 20:48
falcon/util/misc.py Show resolved Hide resolved
falcon/util/misc.py Show resolved Hide resolved
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

Thanks for Sprinting, and thanks for this improvement!
It looks great for the most of it, although we need to revise compliance with the RFC(s) in question before merging.

falcon/util/misc.py Show resolved Hide resolved
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

OK, so given the required polishing is quite limited in scope, we can merge this, and follow up with a new PR to address the mentioned points.

Thank you once again for the thorough analysis of the problem, and working on this, @chgad!

@vytas7 vytas7 merged commit 4f8d639 into falconry:master Aug 27, 2024
37 checks passed
vytas7 added a commit to vytas7/falcon that referenced this pull request Aug 27, 2024
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.

http_date_to_dt() should return a timezone-aware datetime
3 participants