3
3
from trac .web .api import IRequestFilter , IRequestHandler
4
4
from trac .wiki .web_ui import UncycloModule
5
5
from trac .util import Markup
6
+ from trac .util .html import tag
7
+ from tracext .github import GitHubBrowser
6
8
7
9
8
10
class CustomUncycloModule (UncycloModule ):
@@ -55,7 +57,7 @@ class CustomNavigationBar(Component):
55
57
implements (INavigationContributor )
56
58
57
59
def get_active_navigation_item (self , req ):
58
- return ""
60
+ return "custom_reports "
59
61
60
62
def get_navigation_items (self , req ):
61
63
return [
@@ -67,22 +69,14 @@ def get_navigation_items(self, req):
67
69
]
68
70
69
71
70
- try :
71
- # Provided by https://github.com/aaugustin/trac-github
72
- from tracext .github import GitHubBrowser
73
- except ImportError :
74
- pass
75
- else :
76
- from genshi .builder import tag
77
-
78
- class GitHubBrowserWithSVNChangesets (GitHubBrowser ):
79
- def _format_changeset_link (self , formatter , ns , chgset , label , fullmatch = None ):
80
- # Dead-simple version for SVN changesets
81
- if chgset .isnumeric ():
82
- href = formatter .href .changeset (chgset , None , "/" )
83
- return tag .a (label , class_ = "changeset" , href = href )
84
-
85
- # Fallback to the default implemntation
86
- return super (GitHubBrowserWithSVNChangesets , self )._format_changeset_link (
87
- formatter , ns , chgset , label , fullmatch
88
- )
72
+ class GitHubBrowserWithSVNChangesets (GitHubBrowser ):
73
+ def _format_changeset_link (self , formatter , ns , chgset , label , fullmatch = None ):
74
+ # Dead-simple version for SVN changesets.
75
+ if chgset .isnumeric ():
76
+ href = formatter .href .changeset (chgset , None , "/" )
77
+ return tag .a (label , class_ = "changeset" , href = href )
78
+
79
+ # Fallback to the default implementation.
80
+ return super (GitHubBrowserWithSVNChangesets , self )._format_changeset_link (
81
+ formatter , ns , chgset , label , fullmatch
82
+ )
0 commit comments