From 0cde386a2cfec1c18f68f1dfd939843328f8046f Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Apr 2016 10:00:08 -0400 Subject: [PATCH] Remove more unnecessary unicode/text_type, since sanitize_html will always return unicode. --- lib/galaxy/util/validation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/util/validation.py b/lib/galaxy/util/validation.py index 9bf4a8a5d84..a163abf0b44 100644 --- a/lib/galaxy/util/validation.py +++ b/lib/galaxy/util/validation.py @@ -3,23 +3,22 @@ TODO: Refactor BaseController references to similar methods to use this module. """ from galaxy import exceptions -from galaxy.util import unicodify from galaxy.util.sanitize_html import sanitize_html -from six import string_types, text_type +from six import string_types 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 unicodify( sanitize_html( val, 'utf-8', 'text/html' ), 'utf-8' ) + return sanitize_html( val, 'utf-8', 'text/html' ) def validate_and_sanitize_basestring_list( key, val ): try: assert isinstance( val, list ) - return [ text_type( sanitize_html( t, 'utf-8', 'text/html' ), 'utf-8' ) for t in val ] + return [ sanitize_html( t, 'utf-8', 'text/html' ) for t in val ] except ( AssertionError, TypeError ): raise exceptions.RequestParameterInvalidException( '%s must be a list of strings: %s' % ( key, str( type( val ) ) ) )