mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Inet adapter compatible with Python 3.
This commit is contained in:
parent
c176de4bf8
commit
2fa9117835
|
@ -508,7 +508,7 @@ class Inet(object):
|
||||||
obj = _A(self.addr)
|
obj = _A(self.addr)
|
||||||
if hasattr(obj, 'prepare'):
|
if hasattr(obj, 'prepare'):
|
||||||
obj.prepare(self._conn)
|
obj.prepare(self._conn)
|
||||||
return obj.getquoted()+"::inet"
|
return obj.getquoted() + b("::inet")
|
||||||
|
|
||||||
def __conform__(self, foo):
|
def __conform__(self, foo):
|
||||||
if foo is _ext.ISQLQuote:
|
if foo is _ext.ISQLQuote:
|
||||||
|
|
|
@ -114,7 +114,7 @@ class TypesExtrasTests(unittest.TestCase):
|
||||||
a = psycopg2.extensions.adapt(i)
|
a = psycopg2.extensions.adapt(i)
|
||||||
a.prepare(self.conn)
|
a.prepare(self.conn)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
filter_scs(self.conn, "E'192.168.1.0/24'::inet"),
|
filter_scs(self.conn, b("E'192.168.1.0/24'::inet")),
|
||||||
a.getquoted())
|
a.getquoted())
|
||||||
|
|
||||||
# adapts ok with unicode too
|
# adapts ok with unicode too
|
||||||
|
@ -122,7 +122,7 @@ class TypesExtrasTests(unittest.TestCase):
|
||||||
a = psycopg2.extensions.adapt(i)
|
a = psycopg2.extensions.adapt(i)
|
||||||
a.prepare(self.conn)
|
a.prepare(self.conn)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
filter_scs(self.conn, "E'192.168.1.0/24'::inet"),
|
filter_scs(self.conn, b("E'192.168.1.0/24'::inet")),
|
||||||
a.getquoted())
|
a.getquoted())
|
||||||
|
|
||||||
def test_adapt_fail(self):
|
def test_adapt_fail(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user