|
41 | 41 | # Note that gnuradio-dependent modules are loaded lazily, to avoid the startup time if all we're going to do is give a usage message |
42 | 42 | from shinysdr.i.db import DatabaseModel, database_from_csv, databases_from_directory |
43 | 43 | from shinysdr.i.network.base import UNIQUE_PUBLIC_CAP |
44 | | -from shinysdr.i.pycompat import bytes_or_ascii, repr_no_string_tag |
| 44 | +from shinysdr.i.pycompat import repr_no_string_tag |
45 | 45 | from shinysdr.i.roots import CapTable, generate_cap |
46 | 46 |
|
47 | 47 |
|
@@ -127,8 +127,8 @@ def serve_web(self, |
127 | 127 | self._not_finished() |
128 | 128 | # TODO: See if we're reinventing bits of Twisted service stuff here |
129 | 129 |
|
130 | | - http_base_url = _coerce_and_validate_base_url(http_base_url, 'http_base_url', ('http', 'https')) |
131 | | - ws_base_url = _coerce_and_validate_base_url(ws_base_url, 'ws_base_url', ('ws', 'wss'), allow_path=True) |
| 130 | + http_base_url = _coerce_and_validate_base_url(http_base_url, 'http_base_url', (b'http', b'https')) |
| 131 | + ws_base_url = _coerce_and_validate_base_url(ws_base_url, 'ws_base_url', (b'ws', b'wss'), allow_path=True) |
132 | 132 |
|
133 | 133 | if root_cap is not None: |
134 | 134 | root_cap = six.text_type(root_cap) |
@@ -198,11 +198,11 @@ def _coerce_and_validate_base_url(url_value, label, allowed_schemes, allow_path= |
198 | 198 | if url_value is not None: |
199 | 199 | url_value = str(url_value) |
200 | 200 |
|
201 | | - scheme, _netloc, path_bytes, _params, _query_bytes, _fragment = urlparse(bytes_or_ascii(url_value)) |
| 201 | + scheme, _netloc, path_bytes, _params, _query_bytes, _fragment = urlparse(six.ensure_binary(url_value)) |
202 | 202 |
|
203 | 203 | # Ensure that the protocol is compatible. |
204 | 204 | if scheme.lower() not in allowed_schemes: |
205 | | - raise ConfigException('config.serve_web: {} must be a {} URL but was {}'.format(label, ' or '.join(repr_no_string_tag(s + ':') for s in allowed_schemes), repr_no_string_tag(url_value))) |
| 205 | + raise ConfigException('config.serve_web: {} must be a {} URL but was {}'.format(label, ' or '.join(repr_no_string_tag(six.ensure_str(s) + ':') for s in allowed_schemes), repr_no_string_tag(url_value))) |
206 | 206 |
|
207 | 207 | # Ensure that there are no path components. There are two reasons for this: |
208 | 208 | # 1. The client makes use of host-relative URLs. |
|
0 commit comments