Revision 235a4227 snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py

b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
40 40
from sqlalchemy.engine.reflection import Inspector
41 41
from sqlalchemy.exc import NoSuchTableError
42 42

  
43
from dbworker import DBWorker
43
from dbworker import DBWorker, ESCAPE_CHAR
44 44

  
45 45
from pithos.backends.filter import parse_filters
46 46

  
......
237 237

  
238 238
        # Use LIKE for comparison to avoid MySQL problems with trailing spaces.
239 239
        s = select([self.nodes.c.node], self.nodes.c.path.like(
240
            self.escape_like(path), escape='\\'))
240
            self.escape_like(path), escape=ESCAPE_CHAR))
241 241
        r = self.conn.execute(s)
242 242
        row = r.fetchone()
243 243
        r.close()
......
617 617
            c1 = select([self.nodes.c.serial],
618 618
                        self.nodes.c.node == v.c.node)
619 619
        c2 = select([self.nodes.c.node], self.nodes.c.path.like(
620
            self.escape_like(path) + '%', escape='\\'))
620
            self.escape_like(path) + '%', escape=ESCAPE_CHAR))
621 621
        s = s.where(and_(v.c.serial == c1,
622 622
                         v.c.cluster != except_cluster,
623 623
                         v.c.node.in_(c2)))
......
904 904
        for path, match in pathq:
905 905
            if match == MATCH_PREFIX:
906 906
                conj.append(
907
                    n.c.path.like(self.escape_like(path) + '%', escape='\\'))
907
                    n.c.path.like(
908
                        self.escape_like(path) + '%',
909
                        escape=ESCAPE_CHAR
910
                    )
911
                )
908 912
            elif match == MATCH_EXACT:
909 913
                conj.append(n.c.path == path)
910 914
        if conj:
......
999 1003
        for path, match in pathq:
1000 1004
            if match == MATCH_PREFIX:
1001 1005
                conj.append(
1002
                    n.c.path.like(self.escape_like(path) + '%', escape='\\'))
1006
                    n.c.path.like(
1007
                        self.escape_like(path) + '%',
1008
                        escape=ESCAPE_CHAR
1009
                    )
1010
                )
1003 1011
            elif match == MATCH_EXACT:
1004 1012
                conj.append(n.c.path == path)
1005 1013
        if conj:

Also available in: Unified diff