Modify ↓
#13495 closed defect (fixed)
TypeError raised when viewing mercurial changeset
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.5.4 |
Component: | version control | Version: | 1.5.3 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fixed |
||
API Changes: | |||
Internal Changes: |
Description
I encountered the following error while porting mercurial plugin to Python 3:
Traceback (most recent call last): File "/vol/src/tracdev/git/trac/web/main.py", line 610, in dispatch_request dispatcher.dispatch(req) File "/vol/src/tracdev/git/trac/web/main.py", line 302, in dispatch raise e File "/vol/src/tracdev/git/trac/web/main.py", line 248, in dispatch resp = chosen_handler.process_request(req) File "/vol/src/tracdev/git/trac/versioncontrol/web_ui/changeset.py", line 349, in process_request self._render_html(req, repos, chgset, restricted, data) File "/vol/src/tracdev/git/trac/versioncontrol/web_ui/changeset.py", line 424, in _render_html data['properties'] = browser.render_properties('revprop', context, File "/vol/src/tracdev/git/trac/versioncontrol/web_ui/browser.py", line 761, in render_properties [self.render_property(name, mode, context, props) File "/vol/src/tracdev/git/trac/versioncontrol/web_ui/browser.py", line 761, in <listcomp> [self.render_property(name, mode, context, props) File "/vol/src/tracdev/git/trac/versioncontrol/web_ui/browser.py", line 774, in render_property candidates.sort(reverse=True) TypeError: '<' not supported between instances of 'DefaultPropertyRenderer' and 'HgDefaultPropertyRenderer'
Fix:
-
trac/versioncontrol/web_ui/browser.py
diff --git a/trac/versioncontrol/web_ui/browser.py b/trac/versioncontrol/web_ui/browser.py index 98a3d6248..9df4bc7af 100644
a b class BrowserModule(Component): 770 770 quality = renderer.match_property(name, mode) 771 771 if quality > 0: 772 772 candidates.append((quality, renderer)) 773 candidates.sort(reverse=True )773 candidates.sort(reverse=True, key=lambda c: c[0]) 774 774 for (quality, renderer) in candidates: 775 775 try: 776 776 rendered = renderer.render_property(name, mode, context, props)
Work around in mercurial plugin:
def match_property(self, name, mode): - return name.startswith('hg-') and mode == 'revprop' and 1 or 0 + return name.startswith('hg-') and mode == 'revprop' and 2 or 0
Attachments (0)
Change History (3)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in [17620].
comment:3 by , 2 years ago
Owner: | set to |
---|
Note:
See TracTickets
for help on using tickets.
Reconsidering, I think non-default renderer should be preferred with same quality.
trac/versioncontrol/web_ui/browser.py