#NEWLINE# def render( self , name , value , attrs = None ) : #NEWLINE# #INDENT# if attrs : #NEWLINE# #INDENT# self . params . update ( attrs ) #NEWLINE# #UNINDENT# self . params [ 'wkt' ] = '' #NEWLINE# if isinstance ( value , basestring ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = GEOSGeometry ( value ) #NEWLINE# #UNINDENT# except ( GEOSException , ValueError ) : #NEWLINE# #INDENT# value = None #NEWLINE# #UNINDENT# #UNINDENT# if ( value and ( value . geom_type . upper ( ) != self . geom_type ) ) : #NEWLINE# #INDENT# value = None #NEWLINE# #UNINDENT# self . params [ 'map_options' ] = self . map_options ( ) #NEWLINE# self . params [ 'module' ] = ( 'geodjango_%s' % self . params [ 'field_name' ] ) #NEWLINE# if value : #NEWLINE# #INDENT# srid = self . params [ 'srid' ] #NEWLINE# if ( value . srid != srid ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value . transform ( srid ) #NEWLINE# wkt = value . wkt #NEWLINE# #UNINDENT# except OGRException : #NEWLINE# #INDENT# wkt = '' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# wkt = value . wkt #NEWLINE# #UNINDENT# self . params [ 'wkt' ] = wkt #NEWLINE# #UNINDENT# return render_to_string ( self . template , self . params )