##// END OF EJS Templates
python3: fix use of basetring
super-admin -
r4917:39e9fabf default
parent child Browse files
Show More
@@ -178,7 +178,7 b' def aslist(obj, sep=None, strip=True):'
178 178 :param sep:
179 179 :param strip:
180 180 """
181 if isinstance(obj, (basestring,)):
181 if isinstance(obj, (str,)):
182 182 lst = obj.split(sep)
183 183 if strip:
184 184 lst = [v.strip() for v in lst]
@@ -58,7 +58,7 b' def aslist(obj, sep=None, strip=True):'
58 58 :param sep:
59 59 :param strip:
60 60 """
61 if isinstance(obj, (basestring,)):
61 if isinstance(obj, (str,)):
62 62 if obj in ['', ""]:
63 63 return []
64 64
@@ -46,7 +46,7 b' if PY3:'
46 46
47 47 MAXSIZE = sys.maxsize
48 48 else:
49 string_types = basestring,
49 string_types = str,
50 50 integer_types = (int, long)
51 51 class_types = (type, types.ClassType)
52 52 text_type = unicode
@@ -701,7 +701,7 b' if print_ is None:'
701 701 if fp is None:
702 702 return
703 703 def write(data):
704 if not isinstance(data, basestring):
704 if not isinstance(data, str):
705 705 data = str(data)
706 706 # If the file has an encoding, encode unicode with it.
707 707 if (isinstance(fp, file) and
@@ -247,7 +247,7 b' def post_message(channel, message, usern'
247 247 return
248 248
249 249 message_obj = message
250 if isinstance(message, basestring):
250 if isinstance(message, str):
251 251 message_obj = {
252 252 'message': message,
253 253 'level': 'success',
@@ -185,7 +185,7 b' def select(name, selected_values, option'
185 185 for opt in options_iter:
186 186 if isinstance(opt, tuple) and len(opt) == 2:
187 187 value, label = opt
188 elif isinstance(opt, basestring):
188 elif isinstance(opt, str):
189 189 value = label = opt
190 190 else:
191 191 raise ValueError('invalid select option type %r' % type(opt))
@@ -195,7 +195,7 b' def select(name, selected_values, option'
195 195 for opt2 in value:
196 196 if isinstance(opt2, tuple) and len(opt2) == 2:
197 197 group_value, group_label = opt2
198 elif isinstance(opt2, basestring):
198 elif isinstance(opt2, str):
199 199 group_value = group_label = opt2
200 200 else:
201 201 raise ValueError('invalid select option type %r' % type(opt2))
@@ -767,7 +767,7 b' class ScmModel(BaseModel):'
767 767 f_path = safe_str(f_path)
768 768 # decoding here will force that we have proper encoded values
769 769 # in any other case this will throw exceptions and deny commit
770 if isinstance(content, (basestring,)):
770 if isinstance(content, (str,)):
771 771 content = safe_str(content)
772 772 elif isinstance(content, (file, cStringIO.OutputType,)):
773 773 content = content.read()
General Comments 0
You need to be logged in to leave comments. Login now