Inet adapter compatible with Python 3.

This commit is contained in:
Daniele Varrazzo 2010-12-29 03:46:36 +01:00
parent c176de4bf8
commit 2fa9117835
2 changed files with 3 additions and 3 deletions

View File

@ -508,7 +508,7 @@ class Inet(object):
obj = _A(self.addr)
if hasattr(obj, 'prepare'):
obj.prepare(self._conn)
return obj.getquoted()+"::inet"
return obj.getquoted() + b("::inet")
def __conform__(self, foo):
if foo is _ext.ISQLQuote:

View File

@ -114,7 +114,7 @@ class TypesExtrasTests(unittest.TestCase):
a = psycopg2.extensions.adapt(i)
a.prepare(self.conn)
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())
# adapts ok with unicode too
@ -122,7 +122,7 @@ class TypesExtrasTests(unittest.TestCase):
a = psycopg2.extensions.adapt(i)
a.prepare(self.conn)
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())
def test_adapt_fail(self):