Changeset 7407
- Timestamp:
- 04/07/08 17:20:58 (3 months ago)
- Files:
-
- django/branches/gis/django/contrib/gis/db/backend/adaptor.py (added)
- django/branches/gis/django/contrib/gis/db/backend/__init__.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/db/backend/mysql/adaptor.py (deleted)
- django/branches/gis/django/contrib/gis/db/backend/oracle/adaptor.py (deleted)
- django/branches/gis/django/contrib/gis/db/backend/postgis/adaptor.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/db/models/query.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/db/backend/__init__.py
r7104 r7407 48 48 SPATIAL_BACKEND = 'postgis' 49 49 elif settings.DATABASE_ENGINE == 'oracle': 50 from django.contrib.gis.db.backend.oracle.adaptor import \ 51 OracleSpatialAdaptor as GeoAdaptor 50 from django.contrib.gis.db.backend.adaptor import WKTAdaptor as GeoAdaptor 52 51 from django.contrib.gis.db.backend.oracle.field import \ 53 52 OracleSpatialField as GeoBackendField … … 59 58 LIMITED_WHERE = ['relate'] 60 59 elif settings.DATABASE_ENGINE == 'mysql': 61 from django.contrib.gis.db.backend.mysql.adaptor import \ 62 MySQLAdaptor as GeoAdaptor 60 from django.contrib.gis.db.backend.adaptor import WKTAdaptor as GeoAdaptor 63 61 from django.contrib.gis.db.backend.mysql.field import \ 64 62 MySQLGeoField as GeoBackendField django/branches/gis/django/contrib/gis/db/backend/postgis/adaptor.py
r6886 r7407 9 9 class PostGISAdaptor(object): 10 10 def __init__(self, geom): 11 "Initializes on the geometry and the SRID." 12 # Getting the WKB and the SRID 13 self.wkb = geom.wkb 11 "Initializes on the geometry." 12 # Getting the WKB (in string form, to allow easy pickling of 13 # the adaptor) and the SRID from the geometry. 14 self.wkb = str(geom.wkb) 14 15 self.srid = geom.srid 15 16 … … 21 22 raise Exception('Error implementing psycopg2 protocol. Is psycopg2 installed?') 22 23 24 def __eq__(self, other): 25 return (self.wkb == other.wkb) and (self.srid == other.srid) 26 23 27 def __str__(self): 24 28 return self.getquoted() django/branches/gis/django/contrib/gis/db/models/query.py
r7175 r7407 292 292 if not isinstance(geo_field, PointField): 293 293 raise TypeError('Spherical distance calculation only supported on PointFields.') 294 if not isinstance(GEOSGeometry( params[0].wkb), Point):294 if not isinstance(GEOSGeometry(buffer(params[0].wkb)), Point): 295 295 raise TypeError('Spherical distance calculation only supported with Point Geometry parameters') 296 296
