Skip to content

Commit 2f556cf

Browse files
committed
cleanup
1 parent 98723af commit 2f556cf

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

python/tank/authentication/login_dialog.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ def __init__(
208208
self._url_changed_timer = QtCore.QTimer(self)
209209
self._url_changed_timer.setInterval(USER_INPUT_DELAY_BEFORE_SITE_INFO_REQUEST)
210210
self._url_changed_timer.setSingleShot(True)
211-
self._url_changed_timer.timeout.connect(
212-
self._on_site_changed
213-
)
211+
self._url_changed_timer.timeout.connect(self._on_site_changed)
214212

215213
# If the host is fixed, disable the site textbox.
216214
if fixed_host:
@@ -312,16 +310,7 @@ def __init__(
312310
self._query_task = QuerySiteAndUpdateUITask(self, self.site_info, http_proxy)
313311
self._query_task.finished.connect(self._toggle_web)
314312

315-
### self._update_ui_according_to_site_support()#
316-
self._on_site_changed() # trigger the first site info request
317-
318-
# We want to wait until we know what is supported by the site, to avoid
319-
# flickering GUI.
320-
# if not self._query_task.wait(THREAD_WAIT_TIMEOUT_MS):
321-
# logger.warning(
322-
# "Timed out awaiting requesting information: %s"
323-
# % self._get_current_site()
324-
# )
313+
self._on_site_changed() # trigger the first site info request
325314

326315
# Initialize exit confirm message box
327316
self.confirm_box = QtGui.QMessageBox(
@@ -410,7 +399,7 @@ def _update_ui_according_to_site_support(self):
410399
TODO the name and description of this method are not accurate!!!!!
411400
"""
412401

413-
logger.info("_update_ui_according_to_site_support") #, stack_info=True)
402+
logger.debug("_update_ui_according_to_site_support")
414403
self._query_task.url_to_test = self._get_current_site()
415404
self._query_task.start()
416405

@@ -428,15 +417,15 @@ def _on_site_changed(self):
428417
"""
429418

430419
host_selected = connection.sanitize_url(self.ui.site.currentText())
431-
if host_selected == self.host_selected:
420+
if host_selected == self.host_selected:
432421
logger.debug(f"_on_site_changed - site has not changed: {host_selected}")
433422
# No change, nothing to do.
434423
return
435424

436425
self.host_selected = host_selected
437426

438-
# self.ui.login.clear()
439-
# self._populate_user_dropdown(self._get_current_site())
427+
self.ui.login.clear() ## TODO do we really want to do that here?
428+
self._populate_user_dropdown(self._get_current_site()) # same TOTO
440429
self._update_ui_according_to_site_support()
441430

442431
def _populate_user_dropdown(self, site):
@@ -492,9 +481,9 @@ def _toggle_web(self, method_selected=None):
492481
logger.debug("_toggle_web - site-info thread finished too late, we already selected another host")
493482
# the thread finished too late, We already selected another host
494483
return
495-
## Careful, this method is called from a lot different use cases.......!!!!!!
484+
# Careful, this method is called from a lot different use cases.......!!!!!!
496485

497-
# self.method_selected_user = None ## WHY ?????
486+
# self.method_selected_user = None ## WHY ?????
498487

499488
# We only update the GUI if there was a change between to mode we
500489
# are showing and what was detected on the potential target site.
@@ -712,6 +701,14 @@ def result(self):
712701

713702
return self._sso_saml2.get_session_data()
714703

704+
# We want to wait until we know what is supported by the site, to avoid
705+
# flickering GUI.
706+
if not self._query_task.wait(THREAD_WAIT_TIMEOUT_MS):
707+
logger.warning(
708+
"Timed out awaiting requesting information: %s"
709+
% self._get_current_site()
710+
)
711+
715712
res = self.exec_()
716713
if res != QtGui.QDialog.Accepted:
717714
return

python/tank/authentication/session_cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ def _try_load_yaml_file(file_path):
159159
cache = _YML_CONMTENT_CACHE.get(file_path, None)
160160
if cache and (time.time() - _YML_CONMTENT_CACHE_TIMEOUT > cache.get("timeout", 0)):
161161
try:
162-
del(_YML_CONMTENT_CACHE[file_path])
162+
del(_YML_CONMTENT_CACHE[file_path])
163163
except KeyError:
164164
pass
165165

166166
cache = None
167167

168168
if not cache:
169-
cache = {
169+
cache = {
170170
"timeout": time.time(),
171171
"content": _try_load_yaml_file_real(file_path),
172172
}
@@ -520,7 +520,7 @@ def get_current_host():
520520
host = document[_CURRENT_HOST]
521521
if host:
522522
host = connection.sanitize_url(host)
523-
logger.debug(f'Current host is "{host}"') #, stack_info=True, stacklevel=4)
523+
logger.debug(f'Current host is "{host}"')
524524
return host
525525

526526

0 commit comments

Comments
 (0)