From 2fa911783563f1b92a52f3c275d54eea0aefd067 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 29 Dec 2010 03:46:36 +0100 Subject: [PATCH] Inet adapter compatible with Python 3. --- lib/extras.py | 2 +- tests/types_extras.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/extras.py b/lib/extras.py index ba401a23..924fd51a 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -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: diff --git a/tests/types_extras.py b/tests/types_extras.py index 83b4f086..cb17fdf4 100644 --- a/tests/types_extras.py +++ b/tests/types_extras.py @@ -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):