conference.py
def _formatFilters(self, filters):
        """Parse, check validity and format user supplied filters."""
        formatted_filters = []
        inequality_field = None

        for f in filters:
            filtr = {field.name: getattr(
                f, field.name) for field in f.all_fields()}

            try:
                filtr["field"] = FIELDS[filtr["field"]]
                filtr["operator"] = OPERATORS[filtr["operator"]]
            except KeyError:
                raise endpoints.BadRequestException(
                    "Filter contains invalid field or operator.")

            # Every operation except "=" is an inequality
            if filtr["operator"] != "=":
                # check if inequality operation has been used in previous filters
                # disallow the filter if inequality was performed on a different field before
                # track the field on which the inequality operation is performed
                if inequality_field and inequality_field != filtr["field"]:
                    raise endpoints.BadRequestException(
                        "Inequality filter is allowed on only one field.")
                else:
                    inequality_field = filtr["field"]

            formatted_filters.append(filtr)
        return (inequality_field, formatted_filters)
Parse, check validity and format user supplied filters.
Parse, check validity and format user supplied filters.
Parse check validity and format user supplied filters .
def _formatFilters(self, filters):
        formatted_filters = []
        inequality_field = None
        for f in filters:
            filtr = {field.name: getattr(
                f, field.name) for field in f.all_fields()}
            try:
                filtr["field"] = FIELDS[filtr["field"]]
                filtr["operator"] = OPERATORS[filtr["operator"]]
            except KeyError:
                raise endpoints.BadRequestException(
                    "Filter contains invalid field or operator.")
            if filtr["operator"] != "=":
                if inequality_field and inequality_field != filtr["field"]:
                    raise endpoints.BadRequestException(
                        "Inequality filter is allowed on only one field.")
                else:
                    inequality_field = filtr["field"]
            formatted_filters.append(filtr)
        return (inequality_field, formatted_filters)
def _formatFilters ( self , filters ) : formatted_filters = [ ] inequality_field = None for f in filters : filtr = { field . name : getattr ( f , field . name ) for field in f . all_fields ( ) } try : filtr [ "field" ] = FIELDS [ filtr [ "field" ] ] filtr [ "operator" ] = OPERATORS [ filtr [ "operator" ] ] except KeyError : raise endpoints . BadRequestException ( "Filter contains invalid field or operator." ) if filtr [ "operator" ] != "=" : if inequality_field and inequality_field != filtr [ "field" ] : raise endpoints . BadRequestException ( "Inequality filter is allowed on only one field." ) else : inequality_field = filtr [ "field" ] formatted_filters . append ( filtr ) return ( inequality_field , formatted_filters )
Parse, check validity and format user supplied filters.
Parse check validity and format user supplied filters .
"""Parse, check validity and format user supplied filters.""" # Every operation except "=" is an inequality # check if inequality operation has been used in previous filters # disallow the filter if inequality was performed on a different field before # track the field on which the inequality operation is performed
self
filters