~sircmpwn/sr.ht-dev

lists.sr.ht: Don't strip timezone information on import v1 PROPOSED

Simon Ser: 1
 Don't strip timezone information on import

 1 files changed, 2 insertions(+), 2 deletions(-)
#304929 alpine.yml failed
#304930 archlinux.yml failed
#304931 debian.yml failed
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/13919/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH lists.sr.ht] Don't strip timezone information on import Export this patch

datetime.replace discards the previous timezone. Instead, convert to UTC.

This fixes ordering of messages in a thread when each has a different
timezone.
---
 listssrht/process.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/listssrht/process.py b/listssrht/process.py
index 9bea37eba4d9..6ad9bacc5fdf 100644
--- a/listssrht/process.py
+++ b/listssrht/process.py
@@ -20,7 +20,7 @@ import re
import smtplib
import tempfile
from celery import Celery
from datetime import datetime
from datetime import datetime, timezone
from email.mime.text import MIMEText
from email.utils import parseaddr, getaddresses, formatdate, make_msgid
from email.utils import parsedate_to_datetime
@@ -590,7 +590,7 @@ def import_mbox(spool, list_id):
                date = parsedate_to_datetime(date)
                if not date:
                    continue
                date = date.replace(tzinfo=None)
                date = date.astimezone(timezone.utc)
                mail.created = date
                mail.updated = date
                db.session.commit()
-- 
2.28.0
Thanks!

To git@git.sr.ht:~sircmpwn/lists.sr.ht
   0cbabbd..f73352b  master -> master
builds.sr.ht
lists.sr.ht/patches: FAILED in 18m52s

[Don't strip timezone information on import][0] from [Simon Ser][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/13919
[1]: mailto:contact@emersion.fr

✗ #304929 FAILED lists.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/304929
✗ #304931 FAILED lists.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/304931
✗ #304930 FAILED lists.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/304930