#3594 [HOTFIX] Trac mastertickets ticket number handling does not accept hash signs
Closed: Fixed Opened by puiterwijk.

= bug description =
Tickets where the blocking or blocked by fields contain ticket numbers prefixed with hash signs (#...) cause a crash in mastertickets.

= bug analysis =
The mastertickets plugin just runs the python int(..) function on them, which fails as python doesn't see it as an integer.

= fix recommendation =
Hotfix:
{{{
--- web_ui.py 2012-12-08 23:25:36.122629443 +0000
+++ web_ui.py 2012-12-08 23:32:35.775486256 +0000
@@ -48,6 +48,11 @@ class MasterTicketsModule(Component):
# IRequestFilter methods
def pre_process_request(self, req, handler):
return handler
+
+ def strip_prefix_hash(n):
+ if n[0] == '#':
+ n = n[1:]
+ return n

 def post_process_request(self, req, template, data, content_type):
     if req.path_info.startswith('/ticket/'):

@@ -72,11 +77,11 @@ class MasterTicketsModule(Component):
for field, field_data in change['fields'].iteritems():
if field in self.fields:
if field_data['new'].strip():
- new = set([int(n) for n in field_data['new'].split(',')])
+ new = set([int(strip_prefix_hash(n)) for n in field_data['new'].split(',')])
else:
new = set()
if field_data['old'].strip():
- old = set([int(n) for n in field_data['old'].split(',')])
+ old = set([int(strip_prefix_hash(n)) for n in field_data['old'].split(',')])
else:
old = set()
add = new - old
}}}


This fix did NOT work due to extensive errors in multiple locations.

Will be reported upstream, and until then, the plugin is disabled.

Metadata