summary refs log tree commit diff
path: root/synapse/config/appservice.py
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-04-07 00:37:36 +0200
committerAdrian Tschira <nota@notafile.com>2018-04-07 01:02:32 +0200
commite54c202b81707ef02b2e640489a69c2b266bebff (patch)
tree5418a0b3627ae1c880d19e58e839582b9c7a0331 /synapse/config/appservice.py
parentMerge pull request #3046 from matrix-org/dbkr/join_group (diff)
downloadsynapse-e54c202b81707ef02b2e640489a69c2b266bebff.tar.xz
Replace some type checks with six type checks
Signed-off-by: Adrian Tschira <nota@notafile.com>
Diffstat (limited to 'synapse/config/appservice.py')
-rw-r--r--synapse/config/appservice.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py
index aba0aec6e8..9a2359b6fd 100644
--- a/synapse/config/appservice.py
+++ b/synapse/config/appservice.py
@@ -21,6 +21,8 @@ import urllib
 import yaml
 import logging
 
+from six import string_types
+
 logger = logging.getLogger(__name__)
 
 
@@ -89,14 +91,14 @@ def _load_appservice(hostname, as_info, config_filename):
         "id", "as_token", "hs_token", "sender_localpart"
     ]
     for field in required_string_fields:
-        if not isinstance(as_info.get(field), basestring):
+        if not isinstance(as_info.get(field), string_types):
             raise KeyError("Required string field: '%s' (%s)" % (
                 field, config_filename,
             ))
 
     # 'url' must either be a string or explicitly null, not missing
     # to avoid accidentally turning off push for ASes.
-    if (not isinstance(as_info.get("url"), basestring) and
+    if (not isinstance(as_info.get("url"), string_types) and
             as_info.get("url", "") is not None):
         raise KeyError(
             "Required string field or explicit null: 'url' (%s)" % (config_filename,)
@@ -128,7 +130,7 @@ def _load_appservice(hostname, as_info, config_filename):
                         "Expected namespace entry in %s to be an object,"
                         " but got %s", ns, regex_obj
                     )
-                if not isinstance(regex_obj.get("regex"), basestring):
+                if not isinstance(regex_obj.get("regex"), string_types):
                     raise ValueError(
                         "Missing/bad type 'regex' key in %s", regex_obj
                     )