mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 11:43:51 +01:00
Merge pull request #631 from matrix-org/markjh/py3v1
Use syntax that's valid on both py2.7 and py3
This commit is contained in:
commit
ea72bd9600
8 changed files with 10 additions and 10 deletions
|
@ -722,7 +722,7 @@ def run(hs):
|
|||
if hs.config.daemonize:
|
||||
|
||||
if hs.config.print_pidfile:
|
||||
print hs.config.pid_file
|
||||
print (hs.config.pid_file)
|
||||
|
||||
daemon = Daemonize(
|
||||
app="synapse-homeserver",
|
||||
|
|
|
@ -29,13 +29,13 @@ NORMAL = "\x1b[m"
|
|||
|
||||
|
||||
def start(configfile):
|
||||
print "Starting ...",
|
||||
print ("Starting ...")
|
||||
args = SYNAPSE
|
||||
args.extend(["--daemonize", "-c", configfile])
|
||||
|
||||
try:
|
||||
subprocess.check_call(args)
|
||||
print GREEN + "started" + NORMAL
|
||||
print (GREEN + "started" + NORMAL)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print (
|
||||
RED +
|
||||
|
@ -48,7 +48,7 @@ def stop(pidfile):
|
|||
if os.path.exists(pidfile):
|
||||
pid = int(open(pidfile).read())
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
print GREEN + "stopped" + NORMAL
|
||||
print (GREEN + "stopped" + NORMAL)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -28,7 +28,7 @@ if __name__ == "__main__":
|
|||
sys.stderr.write("\n" + e.message + "\n")
|
||||
sys.exit(1)
|
||||
|
||||
print getattr(config, key)
|
||||
print (getattr(config, key))
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.stderr.write("Unknown command %r\n" % (action,))
|
||||
|
|
|
@ -104,7 +104,7 @@ class Config(object):
|
|||
dir_path = cls.abspath(dir_path)
|
||||
try:
|
||||
os.makedirs(dir_path)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
if not os.path.isdir(dir_path):
|
||||
|
|
|
@ -472,7 +472,7 @@ class FederationHandler(BaseHandler):
|
|||
limit=100,
|
||||
extremities=[e for e in extremities.keys()]
|
||||
)
|
||||
except SynapseError:
|
||||
except SynapseError as e:
|
||||
logger.info(
|
||||
"Failed to backfill from %s because %s",
|
||||
dom, e,
|
||||
|
|
|
@ -241,7 +241,7 @@ class RegistrationHandler(BaseHandler):
|
|||
password_hash=None
|
||||
)
|
||||
yield registered_user(self.distributor, user)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
yield self.store.add_access_token_to_user(user_id, token)
|
||||
# Ignore Registration errors
|
||||
logger.exception(e)
|
||||
|
|
|
@ -252,7 +252,7 @@ class SAML2RestServlet(ClientV1RestServlet):
|
|||
SP = Saml2Client(conf)
|
||||
saml2_auth = SP.parse_authn_request_response(
|
||||
request.args['SAMLResponse'][0], BINDING_HTTP_POST)
|
||||
except Exception, e: # Not authenticated
|
||||
except Exception as e: # Not authenticated
|
||||
logger.exception(e)
|
||||
if saml2_auth and saml2_auth.status_ok() and not saml2_auth.not_signed:
|
||||
username = saml2_auth.name_id.text
|
||||
|
|
|
@ -69,7 +69,7 @@ class ExpiringCache(object):
|
|||
if self._max_len and len(self._cache.keys()) > self._max_len:
|
||||
sorted_entries = sorted(
|
||||
self._cache.items(),
|
||||
key=lambda (k, v): v.time,
|
||||
key=lambda item: item[1].time,
|
||||
)
|
||||
|
||||
for k, _ in sorted_entries[self._max_len:]:
|
||||
|
|
Loading…
Reference in a new issue