|
| 1 | +import datetime |
| 2 | + |
| 3 | +import pytz |
1 | 4 | import structlog
|
| 5 | +from django.conf import settings |
2 | 6 | from django.http import HttpResponse
|
3 | 7 | from django.shortcuts import render
|
4 | 8 |
|
@@ -56,3 +60,22 @@ def proxito_404_page_handler(
|
56 | 60 | )
|
57 | 61 | r.status_code = http_status
|
58 | 62 | return r
|
| 63 | + |
| 64 | + |
| 65 | +def allow_readme_html_at_root_url(): |
| 66 | + tzinfo = pytz.timezone("America/Los_Angeles") |
| 67 | + now = datetime.datetime.now(tz=tzinfo) |
| 68 | + |
| 69 | + # Brownout dates as published in https://about.readthedocs.com/blog/2024/05/readme-html-deprecated/ |
| 70 | + # fmt: off |
| 71 | + return not any([ |
| 72 | + # 12 hours browndate |
| 73 | + datetime.datetime(2024, 6, 10, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 6, 10, 12, 0, 0, tzinfo=tzinfo), |
| 74 | + # 24 hours browndate |
| 75 | + datetime.datetime(2024, 6, 17, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 6, 18, 0, 0, 0, tzinfo=tzinfo), |
| 76 | + # 48 hours browndate |
| 77 | + datetime.datetime(2024, 6, 24, 0, 0, 0, tzinfo=tzinfo) < now < datetime.datetime(2024, 6, 26, 0, 0, 0, tzinfo=tzinfo), |
| 78 | + # Deprecated after July 1st |
| 79 | + datetime.datetime(2024, 7, 1, 0, 0, 0, tzinfo=tzinfo) < now, |
| 80 | + ]) and settings.RTD_ENFORCE_BROWNOUTS_FOR_DEPRECATIONS |
| 81 | + # fmt: on |
0 commit comments