Changeset 431
- Timestamp:
- 07/22/10 13:14:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r428 r431 88 88 m = None 89 89 90 # A UTC class needed for trac version 0.11, added by91 # tbaschak at ktc dot mb dot ca92 #93 class UTC(tzinfo):94 """UTC"""95 ZERO = timedelta(0)96 HOUR = timedelta(hours=1)97 98 def utcoffset(self, dt):99 return self.ZERO100 101 def tzname(self, dt):102 return "UTC"103 104 def dst(self, dt):105 return self.ZERO106 107 90 class SaraDict(UserDict.UserDict): 108 91 def __init__(self, dictin = None): … … 866 849 when = int(time.time()) 867 850 else: 868 utc = UTC() 869 when = datetime.now(utc) 851 when = datetime.now(util.datefmt.utc) 870 852 871 853 try: … … 954 936 if error_with_attachments: 955 937 body_text = '%s\\%s' %(error_with_attachments, body_text) 956 938 self.logger.debug('tkt.save_changes(%s, %d)' %(self.author, cnum)) 957 939 tkt.save_changes(self.author, body_text, when, None, str(cnum)) 958 940 … … 1135 1117 tkt['description'] = body_text 1136 1118 1137 #when = int(time.time()) 1138 # 1139 utc = UTC() 1140 when = datetime.now(utc) 1119 # When is the change committed 1120 # 1121 if self.VERSION < 0.11: 1122 when = int(time.time()) 1123 else: 1124 when = datetime.now(util.datefmt.utc) 1141 1125 1142 1126 if self.parameters.dry_run: … … 1241 1225 % (self.id,)) 1242 1226 else: 1227 self.logger.debug('Attach %s to ticket %d' %(util.text.unicode_quote(filename), self.id)) 1243 1228 att = attachment.Attachment(self.env, 'ticket', self.id) 1244 1229 … … 1251 1236 1252 1237 try: 1238 self.logger.debug('Insert atachment') 1253 1239 att.insert(filename, fd, file_size) 1254 1240 except OSError, detail: 1241 self.logger.info('%s\nFilename %s could not be saved, problem: %s' %(status, filename, detail)) 1255 1242 status = '%s\nFilename %s could not be saved, problem: %s' %(status, filename, detail) 1256 1243 … … 2065 2052 2066 2053 except Exception, e: 2067 se t.logger.error('Failure sending notification on creation of ticket #%s: %s' %(self.id, e))2054 self.logger.error('Failure sending notification on creation of ticket #%s: %s' %(self.id, e)) 2068 2055 2069 2056
Note: See TracChangeset
for help on using the changeset viewer.