Skip to content

Commit

Permalink
Sanity check in portal_utils.Portal constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Jan 4, 2024
1 parent 844bf1b commit 3db336b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions dcicutils/portal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ def init_from_key(key: dict, server: Optional[str], unspecified: Optional[list]
self._key_id = key_id
self._secret = secret
self._key_pair = (key_id, secret)
if ((isinstance(server, str) and server) or (isinstance(server := key.get("server"), str) and server)):
if (isinstance(server, str) and server) or (isinstance(server := key.get("server"), str) and server):
if server := normalize_server(server):
if isinstance(key_server := key.get("server"), str) and key_server and key_server != server:
raise Exception(f"Portal server inconsistency: {server} vs {key_server}")
if isinstance(key_server := key.get("server"), str) and key_server:
if normalize_server(key_server) != server:
raise Exception(f"Portal server inconsistency: {server} vs {key_server}")
self._key["server"] = self._server = server
if not self._key:
raise Exception("Portal init error; from key.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.7.0.1b6" # TODO: To become 8.7.1
version = "8.7.0.1b7" # TODO: To become 8.7.1
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 3db336b

Please sign in to comment.