Opened 15 years ago
Last modified 10 years ago
#8945 new enhancement
[PATCH] Send Notification Email with local timezone
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | notification | Version: | |
Severity: | normal | Keywords: | timezone, patch |
Cc: | Thijs Triemstra | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Currently, Trac sends out notifications with an UTC Date header. I would like to see my server's local timezone (patch attached) or even better the users' configured timezone.
Attachments (1)
Change History (10)
by , 15 years ago
Attachment: | trac.notification.patch added |
---|
comment:1 by , 15 years ago
Milestone: | → next-minor-0.12.x |
---|
follow-up: 4 comment:2 by , 14 years ago
Component: | general → notification |
---|---|
Keywords: | timezone added |
Milestone: | next-minor-0.12.x → unscheduled |
For user configured timezone, this is tricky, we would need to send "personalized" mails (same problematic than for translated notification mails).
For using server's local timezone instead of UTC, well, I think it all depends what kind of Trac it is (public project on the internet vs. "in house"), so maybe a setting would make sense here…
(Improved) PatchWelcome ;-)
comment:3 by , 14 years ago
Cc: | added |
---|
follow-up: 5 comment:4 by , 14 years ago
Replying to cboos:
For using server's local timezone instead of UTC, well, I think it all depends what kind of Trac it is (public project on the internet vs. "in house"), so maybe a setting would make sense here…
What about using the default_timezone
setting (for now)?
comment:5 by , 14 years ago
Replying to Thijs Triemstra <lists@…>:
What about using the
default_timezone
setting (for now)?
Sounds like a good idea to me.
comment:6 by , 14 years ago
Cc: | added; removed |
---|---|
Milestone: | unscheduled → next-major-0.1X |
Owner: | set to |
Status: | new → assigned |
follow-up: 8 comment:7 by , 14 years ago
Keywords: | patch added |
---|---|
Summary: | Send Notification Email with local timezone → [PATCH] Send Notification Email with local timezone |
With the original patch, updated for 0.12-stable, I get:
Date: Tue, 07 Dec 2010 17:22:06 +0100
-
trac/notification.py
456 456 headers['To'] = ', '.join(toaddrs) 457 457 if pcc: 458 458 headers['Cc'] = ', '.join(pcc) 459 headers['Date'] = formatdate( )459 headers['Date'] = formatdate(localtime=True) 460 460 msg = MIMEText(body, 'plain') 461 461 # Message class computes the wrong type from MIMEText constructor, 462 462 # which does not take a Charset object as initializer. Reset the
Which is correct but it's a local trac instance so duh. Without the patch I get:
Date: Tue, 07 Dec 2010 16:24:31 -0000
This patch checks for that default_timezone
setting:
-
trac/notification.py
456 456 headers['To'] = ', '.join(toaddrs) 457 457 if pcc: 458 458 headers['Cc'] = ', '.join(pcc) 459 headers['Date'] = formatdate() 459 460 default_tz = self.config.get('trac', 'default_timezone') 461 if default_tz: 462 self.env.log.debug("default_tz: %s" % default_tz) 463 else: 464 default_tz = formatdate() 465 466 headers['Date'] = default_tz 460 467 msg = MIMEText(body, 'plain') 461 468 # Message class computes the wrong type from MIMEText constructor, 462 469 # which does not take a Charset object as initializer. Reset the
but doesn't do anything useful till I figured out what it supposed to hold. The default_timezone
setting isn't documented in TracIni, what are valid options for this setting? Is there a list of this somewhere?
comment:8 by , 14 years ago
Replying to thijstriemstra:
The
default_timezone
setting isn't documented in TracIni, what are valid options for this setting? Is there a list of this somewhere?
It can hold any timezone name, as supported by Trac for the simple timezones (see trac.util.datefmt) and pytz
if installed. The list of available values can be found in trac.util.datefmt.all_timezones
.
comment:9 by , 10 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
This is related to #2182.