(date_filter)
return filter_fn
Function builder that returns a function for processing API date
    parameters.

    :param date_filter: a function which is called with the final value
        of the filter parameters.
Function builder that returns a function for processing API date
    parameters.
Function builder that returns a function for processing API date parameters .
def make_date_filter(date_filter):
    """Function builder that returns a function for processing API date
    parameters.

    :param date_filter: a function which is called with the final value
        of the filter parameters.
    """

    def filter_fn(param, val):
        if param not in ['gt', 'gte', 'lt', 'lte']:
            raise ValueError(_("'{param}' is not a valid type of date range.").format(param=param))
        try:
            # If it's only a date, don't turn it into a datetime
            val = datetime.datetime.strptime(val, '%Y-%m-%d').date()
        except ValueError:
            try:
                val = parse(val)
            except ValueError:
                raise ValueError(_("Cannot parse datetime '{val}'").format(val=val))
        return date_filter(**{param: val})

    return filter_fn
def make_date_filter ( date_filter ) : def filter_fn ( param , val ) : if param not in [ 'gt' , 'gte' , 'lt' , 'lte' ] : raise ValueError ( _ ( "'{param}' is not a valid type of date range." ) . format ( param = param ) ) try : # If it's only a date, don't turn it into a datetime val = datetime . datetime . strptime ( val , '%Y-%m-%d' ) . date ( ) except ValueError : try : val = parse ( val ) except ValueError : raise ValueError ( _ ( "Cannot parse datetime '{val}'" ) . format ( val = val ) ) return date_filter ( * * { param : val } ) return filter_fn