[Twisted-Python] PATCH: adbapi.py string escaping
![](https://secure.gravatar.com/avatar/fcc237fd34a8e504f7224df0c58cc0b3.jpg?s=120&d=mm&r=g)
The 'safe' function in twisted.enterprise.adbapi escapes single quotes, but I know at least Postgres and MySQL also accept backslash escapes, which means embedded backslashes need to be escaped as well, or they will be removed. The attached patch escapes embedded backslashes. I haven't tested it on databases other than Postgres or MySQL. dave
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On 21 Nov 2002 01:39:32 -0800, Dave Peticolas <dave@krondo.com> wrote:
The attached patch escapes embedded backslashes. I haven't tested it on databases other than Postgres or MySQL.
I'm committing this patch, even though it's not really correct, since AFAIK nobody is using Twisted with a different database :-). We should probably be doing escaping using DB-API's interpolation facilities to make sure that it's right for each database (and if it isn't it becomes a driver problem, not a Twisted problem). -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On 21 Nov 2002 01:39:32 -0800, Dave Peticolas <dave@krondo.com> wrote:
The attached patch escapes embedded backslashes. I haven't tested it on databases other than Postgres or MySQL.
I'm committing this patch, even though it's not really correct, since AFAIK nobody is using Twisted with a different database :-). We should probably be doing escaping using DB-API's interpolation facilities to make sure that it's right for each database (and if it isn't it becomes a driver problem, not a Twisted problem). -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |
participants (2)
-
Dave Peticolas
-
Glyph Lefkowitz