Do not reference self.messages when it does not exist (#15331)

This commit is contained in:
Alan Rominger 2024-07-03 16:07:46 -04:00 committed by GitHub
parent ee251812b5
commit ea232315bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2100,15 +2100,18 @@ class WorkflowJobTemplateAccess(NotificationAttachMixin, BaseAccess):
if not self.check_related('organization', Organization, data, role_field='workflow_admin_role', mandatory=True):
if data.get('organization', None) is None:
self.messages['organization'] = [_('An organization is required to create a workflow job template for normal user')]
if self.save_messages:
self.messages['organization'] = [_('An organization is required to create a workflow job template for normal user')]
return False
if not self.check_related('inventory', Inventory, data, role_field='use_role'):
self.messages['inventory'] = [_('You do not have use_role to the inventory')]
if self.save_messages:
self.messages['inventory'] = [_('You do not have use_role to the inventory')]
return False
if not self.check_related('execution_environment', ExecutionEnvironment, data, role_field='read_role'):
self.messages['execution_environment'] = [_('You do not have read_role to the execution environment')]
if self.save_messages:
self.messages['execution_environment'] = [_('You do not have read_role to the execution environment')]
return False
return True