incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#4111] ticket:207 fix ticket search for strange characters
Date Tue, 13 Nov 2012 22:44:37 GMT
Updated Branches:
  refs/heads/master 9375a1416 -> 2e70d7142


[#4111] ticket:207 fix ticket search for strange characters


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2e70d714
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2e70d714
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2e70d714

Branch: refs/heads/master
Commit: 2e70d7142847a91029e3e9a71fc820ef4397b882
Parents: 9375a14
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Nov 9 17:41:16 2012 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Nov 13 22:39:15 2012 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py          |    2 +-
 .../templates/tracker_widgets/bin_form.html        |    4 ++--
 .../forgetracker/tests/functional/test_root.py     |   15 +++++++++++++++
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2e70d714/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index ec3093c..cd23784 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -205,7 +205,7 @@ class Bin(Artifact, ActivityObject):
 
     def url(self):
         base = self.app_config.url() + 'search/?'
-        params = dict(q=(self.terms or ''))
+        params = dict(q=(h.really_unicode(self.terms).encode('utf-8') or ''))
         if self.sort:
             params['sort'] = self.sort
         return base + urllib.urlencode(params)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2e70d714/ForgeTracker/forgetracker/templates/tracker_widgets/bin_form.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/bin_form.html b/ForgeTracker/forgetracker/templates/tracker_widgets/bin_form.html
index 486619e..51347c4 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/bin_form.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/bin_form.html
@@ -5,11 +5,11 @@
   {%- endfor %}
   <div class="grid-7">
     <label class="simple">Bin Name: </label>
-    <input type="text" name="summary" value="{{value.summary}}"/>
+    <input type="text" name="summary" value="{{h.really_unicode(value.summary)}}"/>
   </div>
   <div class="grid-7">
     <label class="simple">Search Terms: </label>
-    <input type="text" name="terms" value="{{value.terms}}"/>
+    <input type="text" name="terms" value="{{h.really_unicode(value.terms)}}"/>
   </div>
   <div class="grid-5" style="text-align: right">
     <input type="submit" value="Save"/>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2e70d714/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 77a0c87..afa0366 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+import urllib
 import os
 import time
 import json
@@ -662,6 +663,20 @@ class TestFunctionalController(TrackerTestController):
         assert '3 results' in response, response.showbrowser()
         assert 'test third ticket' in response, response.showbrowser()
 
+    def test_search_with_strange_chars(self):
+        r = self.app.get('/p/test/bugs/search/?' + urllib.urlencode({'q': 'tést'}))
+        assert 'Search bugs: tést' in r
+
+    def test_saved_search_with_strange_chars(self):
+        '''Sidebar must be visible even with a strange characters in saved search terms'''
+        r = self.app.post('/admin/bugs/bins/save_bin',{
+            'summary': 'Strange chars in terms here',
+            'terms': 'labels:tést',
+            'old_summary': '',
+            'sort': ''}).follow()
+        r = self.app.get('/bugs/')
+        assert sidebar_contains(r, 'Strange chars in terms here')
+
     def test_search_feed(self):
         self.new_ticket(summary='test first ticket')
         ThreadLocalORMSession.flush_all()


Mime
View raw message