From: Karl O. Pinc Date: Fri, 30 Apr 2021 04:04:05 +0000 (-0500) Subject: Better code X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=ad1c87365321a4f50dc1c0803b9063bf8aa1782a;p=pgwui_core Better code --- diff --git a/src/pgwui_core/core.py b/src/pgwui_core/core.py index 7764e9b..8bc424d 100644 --- a/src/pgwui_core/core.py +++ b/src/pgwui_core/core.py @@ -320,16 +320,15 @@ class CredsLoadedForm(LoadedForm): Produces the dict pyramid will use to render the form. ''' response = super().write(result, errors) - if ('havecreds' not in response - or ('havecreds' in response and not response['havecreds'])): + if response.get('havecreds', False): + response['user'] = self['user'] + else: # We don't know if the credentials are good or # we know they are bad. Keep them out of the session. response['user'] = '' response['password'] = '' self.session_put('user', '') self.session_put('password', '') - else: - response['user'] = self['user'] return response