Skip to content

Commit 4221609

Browse files
apollo13felixxm
authored andcommitted
Removed genshi usage from our trac plugin.
1 parent 17aac30 commit 4221609

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

DjangoPlugin/tracdjangoplugin/__init__.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from trac.web.api import IRequestFilter, IRequestHandler
44
from trac.wiki.web_ui import UncycloModule
55
from trac.util import Markup
6+
from trac.util.html import tag
7+
from tracext.github import GitHubBrowser
68

79

810
class CustomUncycloModule(UncycloModule):
@@ -55,7 +57,7 @@ class CustomNavigationBar(Component):
5557
implements(INavigationContributor)
5658

5759
def get_active_navigation_item(self, req):
58-
return ""
60+
return "custom_reports"
5961

6062
def get_navigation_items(self, req):
6163
return [
@@ -67,22 +69,14 @@ def get_navigation_items(self, req):
6769
]
6870

6971

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

Comments
 (0)