Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed escaping

  • Loading branch information...
commit 2e896ba98c0d2efc60e7a3eb77831712012856c5 1 parent 94e140b
@anti-social authored
Showing with 7 additions and 2 deletions.
  1. +1 −1  solar/util.py
  2. +6 −1 tests/test_util.py
View
2  solar/util.py
@@ -188,7 +188,7 @@ def _make_fq(x, level):
if isinstance(child, tuple):
parts = [fq_from_tuple(child)]
elif isinstance(child, basestring):
- parts = [child]
+ parts = [safe_solr_input(child)]
else:
parts = _make_fq(child, level+1)
fq += parts
View
7 tests/test_util.py
@@ -2,7 +2,7 @@
from datetime import datetime
from unittest import TestCase
-from solar.util import X, make_fq
+from solar.util import SafeUnicode, X, make_fq
class UtilTest(TestCase):
def test_X(self):
@@ -52,6 +52,11 @@ def test_make_fq(self):
u"(NOT status:1)")
self.assertEqual(make_fq(~X(status__in=[1, 2, 3])),
u"(NOT (status:1 OR status:2 OR status:3))")
+ self.assertEqual(make_fq(X(u"status:0 OR status:1")),
+ u"status\\:0 or status\\:1")
+ self.assertEqual(make_fq(X(SafeUnicode(u"status:0 OR status:1"))),
+ u"status:0 OR status:1")
+
if __name__ == '__main__':
from unittest import main
Please sign in to comment.
Something went wrong with that request. Please try again.