X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fmethod.py;fp=sfa%2Futil%2Fmethod.py;h=009220c9661ab97f0ee6a8959ead6c2cf4cfc95b;hb=30d9951e075d93127c3909dcb41be09b420b3525;hp=1d3de5754c5987ff360bbfb7da17652b72abbb6f;hpb=faa98a764e6a311400ac54933fca910c8bdd1cf2;p=sfa.git diff --git a/sfa/util/method.py b/sfa/util/method.py index 1d3de575..009220c9 100644 --- a/sfa/util/method.py +++ b/sfa/util/method.py @@ -4,10 +4,11 @@ # import time -from types import IntType, LongType, StringTypes +from types import IntType, LongType import textwrap from sfa.util.sfalogging import logger +from sfa.util.py23 import StringType from sfa.util.faults import SfaFault, SfaInvalidAPIMethod, SfaInvalidArgumentCount, SfaInvalidArgument from sfa.storage.parameter import Parameter, Mixed, python_type, xmlrpc_type @@ -233,7 +234,7 @@ class Method: # Strings are a special case. Accept either unicode or str # types if a string is expected. - if expected_type in StringTypes and isinstance(value, StringTypes): + if issubclass(expected_type, StringType) and isinstance(value, StringType): pass # Integers and long integers are also special types. Accept @@ -247,7 +248,7 @@ class Method: name) # If a minimum or maximum (length, value) has been specified - if expected_type in StringTypes: + if issubclass(expected_type, StringType): if min is not None and \ len(value.encode(self.api.encoding)) < min: raise SfaInvalidArgument("%s must be at least %d bytes long" % (name, min))