Skip to content

Instantly share code, notes, and snippets.

@chadselph
Forked from progrium/gist:1057552
Created June 30, 2011 23:49
Show Gist options
  • Save chadselph/1057572 to your computer and use it in GitHub Desktop.
Save chadselph/1057572 to your computer and use it in GitHub Desktop.
for scope in path_scopes:
filter_constraints = cgi.parse_qs(scope.params.get('params', ''))
filter_keys = set(request.args.keys()) & set(filter_constraints.keys())
def arg_satisfies_filter(f):
return set(request.args[f]).issubset(set(filter_constraints[f]))
if all(arg_satisfies_filter(f) for f in filter_keys):
# if for every parameter, the values are a subset of allowed params, we good!
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment