Trac, Watchlist plugin support for trac 0.12 microsecond feature

This is a patch for getting the WatchPlugin working with trac 0.12.

+++ ./plugin.py    Sat Apr 03 16:56:17 2010
@@ -26,6 +26,7 @@

 from  trac.env         import  IEnvironmentSetupParticipant
 from  trac.util        import  format_datetime, pretty_timedelta
+from trac.util.datefmt import  from_utimestamp, to_utimestamp
 from  trac.web.chrome  import  INavigationContributor
 from  trac.web.api     import  IRequestFilter, IRequestHandler, RequestDone
 from  trac.web.chrome  import  ITemplateProvider, add_ctxtnav, add_link, add_script, add_notice
@@ -38,6 +39,7 @@
 from  trac.wiki.model  import  WikiPage
 from  trac.ticket.model import Ticket

+
 __DB_VERSION__ = 3

 class WatchlistError(TracError):
@@ -347,9 +349,9 @@
 'name' : name,
 'author' : author,
 'version' : version,
-                        'datetime' : format_datetime( time ),
-                        'timedelta' : pretty_timedelta( time ),
-                        'timeline_link' : timeline_link( time ),
+                        'datetime' : from_utimestamp( time ),
+                        'timedelta' : pretty_timedelta( from_utimestamp(time) ),
+                        'timeline_link' : timeline_link( from_utimestamp(time) ),
 'comment' : comment,
 'notify'  : notify,
 })
@@ -426,9 +428,9 @@
 'author' : author,
 'commentnum': to_unicode(self.commentnum),
 'comment' : len(self.comment) <= 250 and self.comment or self.comment[:250] + '...',
-                        'datetime' : format_datetime( changetime ),
-                        'timedelta' : pretty_timedelta( changetime ),
-                        'timeline_link' : timeline_link( changetime ),
+                        'datetime' : from_utimestamp( changetime ),
+                        'timedelta' : pretty_timedelta( from_utimestamp( changetime ) ),
+                        'timeline_link' : timeline_link( from_utimestamp( changetime ) ),
 'changes' : changes,
 'summary' : summary,
 'notify'  : notify,

This patch applies to rev 7710, you can download the patch from trac-Hacks

Have fun 🙂

One thought on “Trac, Watchlist plugin support for trac 0.12 microsecond feature”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.