Skip to content
Draft
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
- ui_busy_dialog
res_files:
- resources
import_pattern: .
3 changes: 1 addition & 2 deletions python/tank/authentication/console_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def authenticate(self, hostname, login, http_proxy):

hostname = sanitize_url(hostname)

site_i = site_info.SiteInfo()
site_i.reload(hostname, http_proxy)
site_i = site_info.get(hostname, http_proxy=http_proxy)

if not site_i.app_session_launcher_enabled:
# Will raise an exception if using a username/password pair is
Expand Down
39 changes: 25 additions & 14 deletions python/tank/authentication/defaults_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(self, fixed_host=None):
self._user_settings = UserSettings()
self._system_settings = SystemSettings()
self._fixed_host = fixed_host
self._host = False # current value might be None
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black would make changes.

self._login = False # current value might be None
Comment on lines +42 to +43
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using False as an uninitialized sentinel conflates it with a valid boolean. Consider using None or a dedicated sentinel constant for clarity.

Suggested change
self._host = False # current value might be None
self._login = False # current value might be None
self._host = None # current value might be None
self._login = None # current value might be None

Copilot uses AI. Check for mistakes.

def is_host_fixed(self):
"""
Expand Down Expand Up @@ -78,11 +80,15 @@ def get_host(self):

:returns: A string containing the default host name.
"""
return (
self._fixed_host
or session_cache.get_current_host()
or self._user_settings.default_site
)

if self._host is False:
self._host = (
self._fixed_host
or session_cache.get_current_host()
or self._user_settings.default_site
)

return self._host

def set_host(self, host):
"""
Expand All @@ -94,6 +100,9 @@ def set_host(self, host):
if self.is_host_fixed():
return
session_cache.set_current_host(host)
self._host = host
# Reset login
self._login = False

def get_http_proxy(self):
"""
Expand Down Expand Up @@ -130,13 +139,17 @@ def get_login(self):
"""
# Make sure there is a current host. There could be none if no-one has
# logged in with Toolkit yet.
if self.get_host():
return (
session_cache.get_current_user(self.get_host())
or self._user_settings.default_login
)
else:
return self._user_settings.default_login

if self._login is False:
if self.get_host():
self._login = (
session_cache.get_current_user(self.get_host())
or self._user_settings.default_login
)
else:
self._login = self._user_settings.default_login

return self._login

def get_user_credentials(self):
"""
Expand All @@ -163,8 +176,6 @@ def get_user_credentials(self):
"""
if self.get_host() and self.get_login():
return session_cache.get_session_data(self.get_host(), self.get_login())
else:
return None

def set_login(self, login):
"""
Expand Down
Loading
Loading