def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
        alias, col, db_type = lvalue

        # Getting the quoted table name as `geo_col`.
        geo_col = '%s.%s' % (qn(alias), qn(col))

        # See if a Oracle Geometry function matches the lookup type next
        lookup_info = self.geometry_functions.get(lookup_type, False)
        if lookup_info:
            # Lookup types that are tuples take tuple arguments, e.g., 'relate' and
            # 'dwithin' lookup types.
            if isinstance(lookup_info, tuple):
                # First element of tuple is lookup type, second element is the type
                # of the expected argument (e.g., str, float)
                sdo_op, arg_type = lookup_info
                geom = value[0]

                # Ensuring that a tuple _value_ was passed in from the user
                if not isinstance(value, tuple):
                    raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)
                if len(value) != 2:
                    raise ValueError('2-element tuple required for %s lookup type.' % lookup_type)

                # Ensuring the argument type matches what we expect.
                if not isinstance(value[1], arg_type):
                    raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))

                if lookup_type == 'relate':
                    # The SDORelate class handles construction for these queries,
                    # and verifies the mask argument.
                    return sdo_op(value[1]).as_sql(geo_col, self.get_geom_placeholder(field, geom))
                else:
                    # Otherwise, just call the `as_sql` method on the SDOOperation instance.
                    return sdo_op.as_sql(geo_col, self.get_geom_placeholder(field, geom))
            else:
                # Lookup info is a SDOOperation instance, whose `as_sql` method returns
                # the SQL necessary for the geometry function call. For example:
                #  SDO_CONTAINS("geoapp_country"."poly", SDO_GEOMTRY('POINT(5 23)', 4326)) = 'TRUE'
                return lookup_info.as_sql(geo_col, self.get_geom_placeholder(field, value))
        elif lookup_type == 'isnull':
            # Handling 'isnull' lookup type
            return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))

        raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
Return full path to the user-shared data dir for this application.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/gis/db/backends/oracle/operations.py/OracleOperations.spatial_lookup_sql--crossover with--dataset/ETHPy150Open Anaconda-Platform/chalmers/chalmers/utils/appdirs.py/site_data_dir