Skip to content

Commit

Permalink
Remove RSS timezone hack
Browse files Browse the repository at this point in the history
This removes the temporary hack introduced by commit a30be12
("Properly handle timezones when building RSS feeds").

As this triggers (I guess due to having items for 2025)

  Extension error (nxt):
  Handler <function nxt_write_rss at 0x7febf3143a60> for event 'build-finished' threw an exception (exception: 'title')
  make: *** [Makefile:24: site] Error 2

Cc: Dan Callahan <[email protected]>
Signed-off-by: Andrew Clayton <[email protected]>
  • Loading branch information
ac000 committed Jan 10, 2025
1 parent a85eff2 commit 0f0683c
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions source/exts/nxt.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,31 +838,6 @@ def nxt_write_rss(app: Sphinx, error: Exception) -> None:

for e in sorted_entries:
date = datetime.fromisoformat(e["date"])
# FIXME: Remove this after posting an article in 2024.
#
# Our previous code allowed the local system timezone to influence how
# timestamps were serialized into <pubDate> fields.
#
# We need to fix that, but we also need to continue generating the old
# values for old posts. Otherwise we'd confuse RSS feed readers.
#
# We can reliably reproduce the old values by:
#
# 1. Starting with a timezone-naive datetime
# 2. Marking it as being in the Europe/London timezone
# 3. Shifting it into UTC
# 4. Stripping the timezone info, so it is again timezone-naive
#
# The last step produces RFC 2822 timestamps with the "-0000" offset,
# instead of timezone-aware UTC "+0000" offset.
#
# We can remove this hack once we've published a few posts in 2024.
if date.year < 2024:
date = (
date.replace(tzinfo=ZoneInfo("Europe/London"))
.astimezone(timezone.utc)
.replace(tzinfo=None)
)
date = format_datetime(date)
lines.append(
f"""<item><title>{e['title']}</title>
Expand Down

0 comments on commit 0f0683c

Please sign in to comment.