Wednesday, September 7, 2011

Re: psycopg2 and Binary

So, it works if I patch
django.contrib.gis.db.backends.postgis.adapter. But that's obviously
*not* the way to go...


class PostGISAdapter(object):
...
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)' %
unicode(Binary(self.ewkb)).replace('\\', '\\\\')

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate