From f30d62a482eb623bd6e1dfa3c9a7284d98bf0719 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Mon, 4 Mar 2024 22:27:29 +0000 Subject: [PATCH] raise exception if hosts and ports do not match --- src/omero/gateway/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/omero/gateway/__init__.py b/src/omero/gateway/__init__.py index 7eb1c46ba..e736f9574 100644 --- a/src/omero/gateway/__init__.py +++ b/src/omero/gateway/__init__.py @@ -1526,10 +1526,18 @@ def __init__(self, username=None, passwd=None, client_obj=None, group=None, self.host = host if self.c is not None: - self.host = self.c.getProperty("omero.host") + hc = self.c.getProperty("omero.host") + if self.host is None: + self.host = hc + else if hc != self.host + raise Exception("hosts %s and %s do not match" % (hc, self.host)) self.port = port if self.c is not None: - self.port = self.c.getProperty("omero.port") + pc = self.c.getProperty("omero.port") + if self.port is None: + self.port = pc + else if pc != self.port + raise Exception("ports %s and %s do not match" % (pc, self.port)) self.secure = secure self.useragent = useragent self.userip = userip