>>> from sqlobject import *
>>> from shapely.wkb import loads
>>> db='postgres://localhost:5432/testpostgis'
>>> connection = connectionForURI(db)
>>> class testpoly(SQLObject):
... _connection = connection
... _fromDatabase = True
... the_geom = StringCol()
... def _get_geom(self):
... value = self._SO_get_the_geom()
... test = loads(value.decode('hex')).wkt
... return test
...
>>> a = testpoly.get(1)
>>> a.geom
'POLYGON ((0.0909447004608300 0.8075576036866360, 0.1416359447004610 0.8014746543778800, 0.3606221198156680 0.7021198156682030, 0.2409907834101380 0.5480184331797230, 0.0868894009216590 0.5845161290322580, 0.0544470046082950 0.7426728110599080, 0.0909447004608300 0.8075576036866360))'
>>>