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