Use Binary adapter instead of converting into hexadecimal and quote ourself

This commit is contained in:
Cédric Krier committed 2018-01-05 18:53:22 +01:00
1 parent 32a509dc04
commit cb60dc5fb4
1 file changed
+3 -3
+3 -3
View File
@@ -3,7 +3,8 @@
import binascii
from geomet import wkb
from psycopg2.extensions import register_adapter, new_type, register_type, AsIs
from psycopg2.extensions import (register_adapter, new_type, register_type,
Binary)
from trytond.backend.postgresql.database import Database as PGDatabase
from trytond.backend.postgresql.database import (
@@ -57,5 +58,4 @@ class Database(PGDatabase):
return conn
register_adapter(_GeoJSON,
lambda value: AsIs("'%s'" % binascii.b2a_hex(wkb.dumps(value)).upper()))
register_adapter(_GeoJSON, lambda value: Binary(wkb.dumps(value)))