Skip to content

Commit

Permalink
Fixed escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social committed Oct 8, 2012
1 parent 94e140b commit 2e896ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion solar/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2e896ba

Please sign in to comment.