Ticket #2: email2trac.patch.txt

File email2trac.patch.txt, 936 bytes (added by tbaschak@…, 14 years ago)

patch for 0.11dev version of trac

Line 
1--- email2trac.py.in    Tue May  1 11:30:57 2007
2@@ -78,6 +78,7 @@
3 import string
4 import getopt
5 import stat
6+from datetime import tzinfo, timedelta, datetime
7 import time
8 import email
9 import email.Iterators
10@@ -97,6 +98,25 @@
11 trac_default_version = 0.10
12 m = None
13
14+ZERO = timedelta(0)
15+HOUR = timedelta(hours=1)
16+
17+# A UTC class.
18+
19+class UTC(tzinfo):
20+    """UTC"""
21+
22+    def utcoffset(self, dt):
23+        return ZERO
24+
25+    def tzname(self, dt):
26+        return "UTC"
27+
28+    def dst(self, dt):
29+        return ZERO
30+
31+utc = UTC()
32+
33
34 class TicketEmailParser(object):
35        env = None
36@@ -401,7 +421,8 @@
37
38                # Get current time
39                #
40-               when = int(time.time())
41+               # when = int(time.time())
42+               when = datetime.now(utc)
43
44                if self.VERSION  == 0.8:
45                        tkt = Ticket(self.db, ticket_id)