diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2016-08-15 02:51:10 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2016-08-15 02:51:10 +0100 |
commit | b006190312684679bf03f8b324bade6861f19436 (patch) | |
tree | 8cbb914d5a47a7eb5a0df407a70bec916f6f3274 /lib/extensions.py | |
parent | 1d950748af199d76069a5fb71bd9f7ace7a2e50e (diff) | |
parent | 47a312cf836e0c4dc2d198f72a139e9af758f443 (diff) | |
download | psycopg2-b006190312684679bf03f8b324bade6861f19436.tar.gz |
Merge branch 'drop-py25'
Diffstat (limited to 'lib/extensions.py')
-rw-r--r-- | lib/extensions.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/extensions.py b/lib/extensions.py index 2130098..309c6ee 100644 --- a/lib/extensions.py +++ b/lib/extensions.py @@ -103,15 +103,6 @@ TRANSACTION_STATUS_INERROR = 3 TRANSACTION_STATUS_UNKNOWN = 4 -# Return bytes from a string -if _sys.version_info[0] < 3: - def b(s): - return s -else: - def b(s): - return s.encode('utf8') - - def register_adapter(typ, callable): """Register 'callable' as an ISQLQuote adapter for type 'typ'.""" adapters[(typ, ISQLQuote)] = callable @@ -136,7 +127,7 @@ class SQL_IN(object): if hasattr(obj, 'prepare'): obj.prepare(self._conn) qobjs = [o.getquoted() for o in pobjs] - return b('(') + b(', ').join(qobjs) + b(')') + return b'(' + b', '.join(qobjs) + b')' def __str__(self): return str(self.getquoted()) @@ -151,7 +142,7 @@ class NoneAdapter(object): def __init__(self, obj): pass - def getquoted(self, _null=b("NULL")): + def getquoted(self, _null=b"NULL"): return _null |