Commits

Anonymous committed 6701a6d

[svn r4593] Fix for trac 0.11 (untested); patch taken from #3319. Closes #3319 and #2819.

Comments (0)

Files changed (1)

0.10/HudsonTrac/HudsonTracPlugin.py

 import time
 import calendar
 import feedparser
+from datetime import datetime
 from trac.core import *
 from trac.config import Option, BoolOption
 from trac.util import Markup, format_datetime
 from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet
-from trac.Timeline import ITimelineEventProvider
+try:
+    from trac.timeline.api import ITimelineEventProvider
+except ImportError:
+    from trac.Timeline import ITimelineEventProvider
 
 class HudsonTracPlugin(Component):
     implements(INavigationContributor, ITimelineEventProvider, ITemplateProvider)
             yield ('build', 'Hudson Builds')
 
     def get_timeline_events(self, req, start, stop, filters):
+	if isinstance(start, datetime): # Trac>=0.11
+        	from trac.util.datefmt import to_timestamp
+        	start = to_timestamp(start)
+        	stop = to_timestamp(stop)
+
         if 'build' in filters:
             add_stylesheet(req, 'HudsonTrac/hudsontrac.css')
 
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.