diff options
author | Marko Kreen | 2007-07-16 14:07:35 +0000 |
---|---|---|
committer | Marko Kreen | 2007-07-16 14:07:35 +0000 |
commit | a030d6371fb4f4679bb00affa3c3c8ff8b08120a (patch) | |
tree | 0b0f305f6964072c1f23c7921e7039780d9340bb /python/skytools/quoting.py | |
parent | 08c0653c5f01ff6e371f70b5da76422344acf3b7 (diff) |
skytools: support for psycopg2
Diffstat (limited to 'python/skytools/quoting.py')
-rw-r--r-- | python/skytools/quoting.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/skytools/quoting.py b/python/skytools/quoting.py index 0ce50080..7df56fee 100644 --- a/python/skytools/quoting.py +++ b/python/skytools/quoting.py @@ -2,7 +2,12 @@ """Various helpers for string quoting/unquoting.""" -import psycopg, urllib, re +import urllib, re + +try: + from psycopg2.extensions import QuotedString +except: + from psycopg import QuotedString __all__ = [ "quote_literal", "quote_copy", "quote_bytea_raw", @@ -23,7 +28,7 @@ def quote_literal(s): if s == None: return "null" - s = psycopg.QuotedString(str(s)) + s = QuotedString(str(s)) return str(s) def quote_copy(s): |