From e12598bf207d357c10ee4beec62dc18a849772ac Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:44:41 -0600 Subject: [PATCH] Fix linter --- ops/scripts/manifest-sandbox-template.yaml | 1 - src/registrar/models/domain.py | 36 ++++++++++------------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ops/scripts/manifest-sandbox-template.yaml b/ops/scripts/manifest-sandbox-template.yaml index a521aab09..1bf979c9f 100644 --- a/ops/scripts/manifest-sandbox-template.yaml +++ b/ops/scripts/manifest-sandbox-template.yaml @@ -11,7 +11,6 @@ applications: command: ./run.sh health-check-type: http health-check-http-endpoint: /health - health-check-invocation-timeout: 30 env: # Send stdout and stderr straight to the terminal without buffering PYTHONUNBUFFERED: yup diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py index d0f19d5a7..34fe9b880 100644 --- a/src/registrar/models/domain.py +++ b/src/registrar/models/domain.py @@ -704,20 +704,17 @@ class Domain(TimeStampedModel, DomainHelper): auth_info = contact.auth_info postal_info = contact.postal_info addr = postal_info.addr - streets = {} - if addr is not None and addr.street is not None: - # 'zips' two lists together. - # For instance, (('street1', 'some_value_here'), - # ('street2', 'some_value_here')) - # Dict then converts this to a useable kwarg which we can pass in - streets = dict( - zip_longest( - ["street1", "street2", "street3"], - addr.street, - fillvalue=None, - ) + # 'zips' two lists together. + # For instance, (('street1', 'some_value_here'), + # ('street2', 'some_value_here')) + # Dict then converts this to a useable kwarg which we can pass in + streets = dict( + zip_longest( + ["street1", "street2", "street3"], + addr.street if addr is not None else [], + fillvalue=None, ) - + ) desired_contact = PublicContact( domain=self, contact_type=contact_type, @@ -725,13 +722,14 @@ class Domain(TimeStampedModel, DomainHelper): email=contact.email or "", voice=contact.voice or "", fax=contact.fax, - pw=auth_info.pw or "", name=postal_info.name or "", org=postal_info.org, - city=addr.city or "", - pc=addr.pc or "", - cc=addr.cc or "", - sp=addr.sp or "", + # For linter - default to "" instead of None + pw=getattr(auth_info, 'pw', ""), + city=getattr(addr, 'city', ""), + pc=getattr(addr, 'pc', ""), + cc=getattr(addr, 'cc', ""), + sp=getattr(addr, 'sp', ""), **streets, ) @@ -753,7 +751,7 @@ class Domain(TimeStampedModel, DomainHelper): def generic_contact_getter( self, contact_type_choice: PublicContact.ContactTypeChoices - ) -> PublicContact: + ) -> PublicContact | None: """Abstracts the cache logic on EppLib contact items contact_type_choice is a literal in PublicContact.ContactTypeChoices,