Misc fixes - #678
Merged
Merged
Conversation
Replace the hand-rolled method check, which set the non-existent "Allowed" header, with Django's require_POST decorator, which sets the correct "Allow" header.
AUTH_PROFILE_MODULE has been a no-op since its removal in Django 1.7, and TEST_RUNNER only restated the Django default.
feedparser 6.x still warns when accessing updated_parsed on an entry that only has published_parsed, because attribute access falls back to the published field for backwards compatibility. Checking containment with `in` bypasses the fallback, so we no longer trigger the warning and can drop the blanket warning suppression.
Setting the umask as a side effect of importing the models module dates back to when downloaded media had to be group-writable for other local processes. With the containerized setup, a single process writes and serves the media dir, so the default umask is fine.
The feedback form sent email to settings.ADMINS, which was never defined, so the feedback was silently sent to no recipients. Define ADMINS from the DJANGO_ADMINS environment variable, using Django 6's list-of-addresses format.
Replace naive dt.date.today() with timezone.localdate() in views, and with the crawler's own current_date property in the crawler base class, which respects the comic's time zone.
Parse ISO dates with date.fromisoformat() instead of strptime(), and compute UNIX time from the tz-aware datetime directly instead of going through time.mktime() with local-time semantics. With all naive datetime usage gone, enable ruff's flake8-datetimez rules, with an exception for the generic strptime() in the crawler API's string_to_date() helper.
The assert statements only narrowed types for the type checker and are stripped when Python runs with -O, and a missing key in request.POST would raise a 500 instead of a client error.
The redirect view with its meta-refresh interstitial existed to avoid leaking referrer traces to the comics' websites, but the sitewide Referrer-Policy: same-origin header (Django's SECURE_REFERRER_POLICY default, served by SecurityMiddleware) already stops the browser from sending any Referer header on cross-origin navigation. The interstitial added nothing on top of the policy, so remove the view entirely and link directly to the comics' websites.
rel="start", rel="first", and rel="last" were dropped from the HTML spec and are ignored by modern browsers; rel="prev"/"next" remain.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
==========================================
+ Coverage 59.89% 60.16% +0.27%
==========================================
Files 41 41
Lines 2057 2036 -21
==========================================
- Hits 1232 1225 -7
+ Misses 825 811 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.