projects
/
pithos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e8d003e
)
Escape special characters for LIKE in node lookup.
pithos/v0.8.1
author
Antony Chazapis
<chazapis@gmail.com>
Mon, 5 Dec 2011 16:38:33 +0000
(18:38 +0200)
committer
Antony Chazapis
<chazapis@gmail.com>
Mon, 5 Dec 2011 16:38:33 +0000
(18:38 +0200)
pithos/backends/lib/sqlalchemy/node.py
patch
|
blob
|
history
diff --git
a/pithos/backends/lib/sqlalchemy/node.py
b/pithos/backends/lib/sqlalchemy/node.py
index
7cf3827
..
4a0fc55
100644
(file)
--- a/
pithos/backends/lib/sqlalchemy/node.py
+++ b/
pithos/backends/lib/sqlalchemy/node.py
@@
-209,6
+209,9
@@
class Node(DBWorker):
Return None if the path is not found.
"""
+ # Use LIKE for comparison to avoid MySQL problems with trailing spaces.
+ path = path.replace('%', '\%')
+ path = path.replace('_', '\_')
s = select([self.nodes.c.node], self.nodes.c.path.like(path))
r = self.conn.execute(s)
row = r.fetchone()