diff options
| author | Pranay Suresh <psuresh@teslamotors.com> | 2016-04-10 13:41:57 -0700 |
|---|---|---|
| committer | Pranay Suresh <psuresh@teslamotors.com> | 2016-04-10 13:41:57 -0700 |
| commit | cfdbc9cca2f812c25739830ac4aa8a00f42e99c6 (patch) | |
| tree | 5c6081fb8652f4d68605394bb435506b91259add /webtest | |
| parent | dcdaf161267755233318d1882444f083491d3ed6 (diff) | |
| download | webtest-cfdbc9cca2f812c25739830ac4aa8a00f42e99c6.tar.gz | |
reduce complexity use text_type
Diffstat (limited to 'webtest')
| -rw-r--r-- | webtest/app.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/webtest/app.py b/webtest/app.py index 1b2de79..affa69d 100644 --- a/webtest/app.py +++ b/webtest/app.py @@ -205,17 +205,9 @@ class TestApp(object): val = ':'.join(list(val)) val = b64encode(to_bytes(val)).strip() val = val.decode('latin1') - elif authtype == 'Bearer': - if sys.version_info >= (3, 0, 0): - if val and isinstance(val, str): - val = val.strip() - else: - raise ValueError(invalid_value) - else: - if val and isinstance(val, (str, unicode)): - val = val.strip() - else: - raise ValueError(invalid_value) + elif authtype == 'Bearer' and val and \ + isinstance(val, text_type): + val = val.strip() else: raise ValueError(invalid_value) value = str('%s %s' % (authtype, val)) |
