- Timestamp:
- 02/10/08 20:25:01 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/db/backend/util.py
r6919 r7104 1 class GeoFieldSQL(object): 1 from types import UnicodeType 2 3 def gqn(val): 2 4 """ 3 Container for passing values to `parse_lookup` from the various 4 backend geometry fields. 5 The geographic quote name function; used for quoting tables and 6 geometries (they use single rather than the double quotes of the 7 backend quotename function). 5 8 """ 6 def __init__(self, where=[], params=[]): 7 self.where = where 8 self.params = params 9 10 def __str__(self): 11 return self.as_sql() 12 13 def as_sql(self, quote=False): 14 if not quote: 15 return self.where[0] % tuple(self.params) 16 else: 17 # Used for quoting WKT on certain backends. 18 tmp_params = ["'%s'" % self.params[0]] 19 tmp_params.extend(self.params[1:]) 20 return self.where[0] % tuple(tmp_params) 9 if isinstance(val, basestring): 10 if isinstance(val, UnicodeType): val = val.encode('ascii') 11 return "'%s'" % val 12 else: 13 return str(val) 21 14 22 15 class SpatialOperation(object):
