Anonymous avatar Anonymous committed 5fded06

[svn r10617] EstimationToolsPlugin: Milestone names with '(' or ')' in them display no data. Need to unquote parenthesis for query arguments. Closes #8299.

Comments (0)

Files changed (2)

estimationtools/tests/burndownchart.py

                         "milestone=One & Two, startdate=%s, enddate=%s" % (start, end))
         self.failUnless("&chtt=One+%26+Two&" in str(result))
 
+    def test_url_encode_parenthesis(self):
+        # http://trac-hacks.org/ticket/8299
+        start = (datetime.now(utc).date() - timedelta(days=1)).strftime('%Y-%m-%d')
+        end = (datetime.now(utc).date() + timedelta(days=1)).strftime('%Y-%m-%d')
+        chart = BurndownChart(self.env)
+        def verify_milestone(milestone):
+            t = Ticket(self.env, self._insert_ticket('12'))
+            t['milestone'] = milestone
+            t.save_changes('', '')
+            result = chart.expand_macro(self.formatter, 'BurndownChart',
+                        "milestone=%s, startdate=%s, enddate=%s" \
+                        % (milestone, start, end))
+            args = self._extract_query(result)
+            # data
+            self.assertEquals((milestone, args['chd']),
+                              (milestone, [u't:0.00,50.00,100.00|0.00,100.00,-1']))
+            # scaling / axis
+            self.assertEquals((milestone, args['chxr']), (milestone, [u'2,0,12']))
+            # title
+            self.assertEquals(args['chtt'], [milestone])
+        verify_milestone('Test')
+        verify_milestone('T(es)t')
+        verify_milestone('(Test)')
+
     def test_expected_y_axis(self):
         start = datetime.now(utc).date()
         end = (start + timedelta(days=5)).strftime('%Y-%m-%d')

estimationtools/utils.py

                         .replace('%21=', '!=')\
                         .replace('%7C', '|')\
                         .replace('+', ' ')\
-                        .replace('%23', '#')
+                        .replace('%23', '#')\
+                        .replace('%28', '(')\
+                        .replace('%29', ')')
     env.log.debug("query_string: %s" % query_string)
     query = Query.from_string(env, query_string)
 
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.