Commits

Tetsuya Morimoto committed e6f4ab4

fixed to keep Python 2.4 compatibility

Comments (0)

Files changed (3)

             self.env.log.info('task is finished: %s' % task_id)
 
 
-class Ticker():
+class Ticker(object):
     """
     A Ticker is simply a simply timer that will repeatly wake up.
     """
             self.timer.join()
 
 
-class CronConfig():
+class CronConfig(object):
     """
     This class read and write configuration for TracCronPlugin
     """

traccron/listener.py

         return NotifyEmail.send(self, torcpts, ccrcpts)
 
 
-class StartTaskEvent():
+class StartTaskEvent(object):
     """
     Store the event of a task start
     """
         self.time = localtime(time())
 
 
-class EndTaskEvent():
+class EndTaskEvent(object):
     """
     Store the event of a task end
     """
 ##
 ###############################################################################
 from datetime import datetime, timedelta
-from time import time, localtime
+from time import strptime, time, localtime
 
 from trac.ticket.model import Ticket
 from trac.config import BoolOption, IntOption, Option
 
     def need_notify(self, now, deadline, date_format, days_before):
         try:
-            due_date = datetime.strptime(deadline, date_format)
+            # don't use datetime.strptime for 2.4 compatibility
+            due_date = datetime(*strptime(deadline, date_format)[:6])
             due_date = due_date - timedelta(days=int(days_before))
-        except:
-            self.env.log.error('cannot convert deadline: %s' % due_date)
+        except Exception, e:
+            self.env.log.error('cannot convert %s: %s' % (deadline, e))
         else:
             self.env.log.debug('need_notify: %s, %s' % (now, due_date))
             return now >= due_date
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.