Show
Ignore:
Timestamp:
07/17/09 14:29:31 (3 years ago)
Author:
wyatt
Message:

More movement toward 'modernization'.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Core/trunk/bycycle/core/model/data/sqltypes.py

    r1155 r1186  
    22 
    33from shapely import geometry, wkb 
    4 import pyproj 
    5  
    6 from binascii import a2b_hex, b2a_hex 
    74 
    85 
     
    1310        super(Geometry, self).__init__() 
    1411        self.SRID = SRID 
    15         self.proj = pyproj.Proj(init='epsg:%s' % SRID) 
    1612        self.type = type_.upper() 
    1713        self.dimension = dimension 
     
    2319        """Convert from Python type to database type.""" 
    2420        def process(value): 
     21            """``value`` is a Python/Shapely geometry object.""" 
    2522            if value is None: 
    2623                return None 
    2724            else: 
    28                 return 'SRID=%s;%s' % (self.SRID, b2a_hex(value.to_wkb())) 
     25                return 'SRID=%s;%s' % (self.SRID, value) 
    2926        return process 
    3027 
     
    3229        """Convert from database type to Python type.""" 
    3330        def process(value): 
     31            """``value`` is a hex-encoded WKB string.""" 
    3432            if value is None: 
    3533                return None 
    3634            else: 
    37                 return wkb.loads(a2b_hex(value)) 
     35                return wkb.loads(value.decode('hex')) 
    3836        return process 
    3937