Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 338268 Details for
Bug 399417
<dev-python/django-1.4: Bad geometry escape in PostGIS
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Improved escaping of PostgreSQL geometries
postgis-adapter-2.patch (text/plain), 1.20 KB, created by
Aaron W. Swenson
on 2013-02-07 19:27:42 UTC
(
hide
)
Description:
Improved escaping of PostgreSQL geometries
Filename:
MIME Type:
Creator:
Aaron W. Swenson
Created:
2013-02-07 19:27:42 UTC
Size:
1.20 KB
patch
obsolete
>--- django/contrib/gis/db/backends/postgis/adapter.py.orig 2011-09-09 11:51:27.769648151 +0100 >+++ django/contrib/gis/db/backends/postgis/adapter.py 2011-09-12 14:09:51.733962708 +0100 >@@ -12,6 +12,7 @@ > # the adaptor) and the SRID from the geometry. > self.ewkb = str(geom.ewkb) > self.srid = geom.srid >+ self._adapter = Binary(self.ewkb) > > def __conform__(self, proto): > # Does the given protocol conform to what Psycopg2 expects? >@@ -26,10 +27,15 @@ > def __str__(self): > return self.getquoted() > >+ def prepare(self, conn): >+ # Pass the connection to the adapter: this allows escaping the binary >+ # in the style required by the server's standard_conforming_string setting. >+ self._adapter.prepare(conn) >+ > def getquoted(self): > "Returns a properly quoted string for use in PostgreSQL/PostGIS." >- # Want to use WKB, so wrap with psycopg2 Binary() to quote properly. >- return 'ST_GeomFromEWKB(E%s)' % Binary(self.ewkb) >+ # psycopg will figure out whether to use E'\\000' or '\000' >+ return 'ST_GeomFromEWKB(%s)' % self._adapter.getquoted() > > def prepare_database_save(self, unused): > return self
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 399417
:
299331
| 338268