Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Updated PostGIS adapter

  • Loading branch information...
commit 874908e3bba8538d1c108e1b38f9d9519c6e5416 1 parent 799786a
@claudep claudep authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/contrib/gis/db/backends/postgis/adapter.py
View
5 django/contrib/gis/db/backends/postgis/adapter.py
@@ -1,6 +1,7 @@
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
+from __future__ import unicode_literals
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
@@ -10,7 +11,7 @@ def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB (in string form, to allow easy pickling of
# the adaptor) and the SRID from the geometry.
- self.ewkb = str(geom.ewkb)
+ self.ewkb = bytes(geom.ewkb)
self.srid = geom.srid
self._adapter = Binary(self.ewkb)
@@ -39,7 +40,7 @@ def prepare(self, conn):
def getquoted(self):
"Returns a properly quoted string for use in PostgreSQL/PostGIS."
# psycopg will figure out whether to use E'\\000' or '\000'
- return 'ST_GeomFromEWKB(%s)' % self._adapter.getquoted()
+ return str('ST_GeomFromEWKB(%s)' % self._adapter.getquoted().decode())
def prepare_database_save(self, unused):
return self
Please sign in to comment.
Something went wrong with that request. Please try again.