[fix] database: escape percent sign in strings

This commit is contained in:
Cristi Harjoi 2015-10-23 14:03:38 +03:00
parent 11d5ba9f5b
commit 006a2a1754

View file

@ -785,7 +785,7 @@ class Database:
self._conn = None
def escape(self, s):
"""Excape quotes in given string."""
"""Excape quotes and percent in given string."""
if isinstance(s, unicode):
s = (s or "").encode("utf-8")
return unicode(MySQLdb.escape_string(s), "utf-8")
return unicode(MySQLdb.escape_string(s), "utf-8").replace("%","%%")