mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-10 03:23:04 +00:00
Apply suggestions from code review
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
This commit is contained in:
@@ -210,7 +210,7 @@ class UserListAPIHandler(APIHandler):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error("Failed to create user: %s" % name, exc_info=True)
|
self.log.error("Failed to create user: %s" % name, exc_info=True)
|
||||||
self.users.delete(user)
|
self.users.delete(user)
|
||||||
raise web.HTTPError(400, f"Failed to create user {name}: {str(e)}")
|
raise web.HTTPError(400, f"Failed to create user {name}: {e}")
|
||||||
else:
|
else:
|
||||||
created.append(user)
|
created.append(user)
|
||||||
|
|
||||||
|
@@ -623,7 +623,7 @@ class BaseHandler(RequestHandler):
|
|||||||
if (next_url + '/').startswith(
|
if (next_url + '/').startswith(
|
||||||
(
|
(
|
||||||
f'{self.request.protocol}://{self.request.host}/',
|
f'{self.request.protocol}://{self.request.host}/',
|
||||||
'//%s/' % self.request.host,
|
f'//{self.request.host}/',
|
||||||
)
|
)
|
||||||
) or (
|
) or (
|
||||||
self.subdomain_host
|
self.subdomain_host
|
||||||
|
@@ -148,7 +148,9 @@ class Server(HasTraits):
|
|||||||
def host(self):
|
def host(self):
|
||||||
if self.connect_url:
|
if self.connect_url:
|
||||||
parsed = urlparse(self.connect_url)
|
parsed = urlparse(self.connect_url)
|
||||||
return f"{parsed.scheme}://{parsed.netloc}"
|
proto = parsed.scheme
|
||||||
|
host = parsed.netloc
|
||||||
|
return f"{proto}://{host}"
|
||||||
|
|
||||||
if ':' in self._connect_ip:
|
if ':' in self._connect_ip:
|
||||||
fmt = "{proto}://[{ip}]:{port}"
|
fmt = "{proto}://[{ip}]:{port}"
|
||||||
|
@@ -1039,8 +1039,6 @@ def get_class(resource_name):
|
|||||||
}
|
}
|
||||||
if resource_name not in class_dict:
|
if resource_name not in class_dict:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Kind must be one of {}, not {}".format(
|
f'Kind must be one of {", ".join(class_dict)}, not {resource_name}'
|
||||||
", ".join(class_dict), resource_name
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return class_dict[resource_name]
|
return class_dict[resource_name]
|
||||||
|
Reference in New Issue
Block a user