mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Rename GovernmentDomain to AgreementInfo
This better describes the data encapsulated by this class, and how we are now using it.
This commit is contained in:
@@ -9,7 +9,7 @@ from app import convert_to_boolean
|
||||
from app.main import main
|
||||
from app.main.forms import SearchTemplatesForm
|
||||
from app.main.views.sub_navigation_dictionaries import features_nav
|
||||
from app.utils import GovernmentDomain
|
||||
from app.utils import AgreementInfo
|
||||
|
||||
|
||||
@main.route('/')
|
||||
@@ -154,7 +154,7 @@ def terms():
|
||||
return render_template(
|
||||
'views/terms-of-use.html',
|
||||
navigation_links=features_nav(),
|
||||
agreement_info=GovernmentDomain.from_current_user(),
|
||||
agreement_info=AgreementInfo.from_current_user(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ from app.main.forms import (
|
||||
SMSPrefixForm,
|
||||
)
|
||||
from app.utils import (
|
||||
GovernmentDomain,
|
||||
AgreementInfo,
|
||||
email_safe,
|
||||
get_cdn_domain,
|
||||
user_has_permissions,
|
||||
@@ -205,7 +205,7 @@ def submit_request_to_go_live(service_id):
|
||||
current_service['name'],
|
||||
url_for('main.service_dashboard', service_id=current_service['id'], _external=True),
|
||||
current_service['organisation_type'],
|
||||
GovernmentDomain.from_current_user().as_human_readable,
|
||||
AgreementInfo.from_current_user().as_human_readable,
|
||||
formatted_list(filter(None, (
|
||||
'email' if form.channel_email.data else None,
|
||||
'text messages' if form.channel_sms.data else None,
|
||||
|
||||
10
app/utils.py
10
app/utils.py
@@ -443,7 +443,7 @@ def set_status_filters(filter_args):
|
||||
_dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
class GovernmentDomain:
|
||||
class AgreementInfo:
|
||||
|
||||
with open('{}/domains.yml'.format(_dir_path)) as domains:
|
||||
domains = yaml.safe_load(domains)
|
||||
@@ -460,7 +460,7 @@ class GovernmentDomain:
|
||||
self.owner,
|
||||
self.crown_status,
|
||||
self.agreement_signed
|
||||
) = self._get_details_of_domain()
|
||||
) = self._get_info()
|
||||
|
||||
@classmethod
|
||||
def from_user(cls, user):
|
||||
@@ -507,12 +507,12 @@ class GovernmentDomain:
|
||||
|
||||
return fn
|
||||
|
||||
def _get_details_of_domain(self):
|
||||
def _get_info(self):
|
||||
|
||||
details = self.domains.get(self._match) or {}
|
||||
|
||||
if isinstance(details, str):
|
||||
return GovernmentDomain(details)._get_details_of_domain()
|
||||
return AgreementInfo(details)._get_info()
|
||||
|
||||
elif isinstance(details, dict):
|
||||
return(
|
||||
@@ -526,7 +526,7 @@ class NotGovernmentEmailDomain(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class GovernmentEmailDomain(GovernmentDomain):
|
||||
class GovernmentEmailDomain(AgreementInfo):
|
||||
|
||||
with open('{}/email_domains.yml'.format(_dir_path)) as email_domains:
|
||||
domain_names = yaml.safe_load(email_domains)
|
||||
|
||||
Reference in New Issue
Block a user