Mercurial > repos > shellac > guppy_basecaller
diff env/lib/python3.7/site-packages/galaxy/util/validation.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 (2020-06-01) |
parents | 79f47841a781 |
children |
line wrap: on
line diff
--- a/env/lib/python3.7/site-packages/galaxy/util/validation.py Thu May 14 16:47:39 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -""" Module for validation of incoming inputs. - -TODO: Refactor BaseController references to similar methods to use this module. -""" -from six import string_types - -from galaxy import exceptions -from galaxy.util.sanitize_html import sanitize_html - - -def validate_and_sanitize_basestring(key, val): - if not isinstance(val, string_types): - raise exceptions.RequestParameterInvalidException('%s must be a string or unicode: %s' - % (key, str(type(val)))) - return sanitize_html(val) - - -def validate_and_sanitize_basestring_list(key, val): - try: - assert isinstance(val, list) - return [sanitize_html(t) for t in val] - except (AssertionError, TypeError): - raise exceptions.RequestParameterInvalidException('%s must be a list of strings: %s' - % (key, str(type(val)))) - - -def validate_boolean(key, val): - if not isinstance(val, bool): - raise exceptions.RequestParameterInvalidException('%s must be a boolean: %s' - % (key, str(type(val)))) - return val - - -# TODO: -# def validate_integer(self, key, val, min, max): -# def validate_float(self, key, val, min, max): -# def validate_number(self, key, val, min, max): -# def validate_genome_build(self, key, val):