#NEWLINE# def _spatial_setup( self , att , desc = None , field_name = None , geo_field_type = None ) : #NEWLINE# #INDENT# '\n        Performs set up for executing the spatial function.\n        ' #NEWLINE# connection = connections [ self . db ] #NEWLINE# func = getattr ( connection . ops , att , False ) #NEWLINE# if ( desc is None ) : #NEWLINE# #INDENT# desc = att #NEWLINE# #UNINDENT# if ( not desc ) : #NEWLINE# #INDENT# raise NotImplementedError ( ( '%s stored procedure not available on the %s backend.' % ( desc , connection . ops . name ) ) ) #NEWLINE# #UNINDENT# procedure_args = { #NEWLINE# #INDENT# 'function' : func , #NEWLINE# #UNINDENT# } #NEWLINE# geo_field = self . _geo_field ( field_name ) #NEWLINE# if ( not geo_field ) : #NEWLINE# #INDENT# raise TypeError ( ( '%s output only available on GeometryFields.' % func ) ) #NEWLINE# #UNINDENT# if ( ( geo_field_type is not None ) and ( not isinstance ( geo_field , geo_field_type ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '"%s" stored procedures may only be called on %ss.' % ( func , geo_field_type . __name__ ) ) ) #NEWLINE# #UNINDENT# procedure_args [ 'geo_col' ] = self . _geocol_select ( geo_field , field_name ) #NEWLINE# return ( procedure_args , geo_field )