Merge pull request #8471 from ryanpetrello/whoops-scm

fix a minor bug introduced in Project save validation

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-10-27 20:13:53 +00:00
committed by GitHub

View File

@@ -1333,7 +1333,7 @@ class ProjectOptionsSerializer(BaseSerializer):
scm_type = attrs.get('scm_type', u'') or u'' scm_type = attrs.get('scm_type', u'') or u''
if self.instance and not scm_type: if self.instance and not scm_type:
valid_local_paths.append(self.instance.local_path) valid_local_paths.append(self.instance.local_path)
if scm_type and "local_path" in attrs and self.instance.local_path != attrs['local_path']: if self.instance and scm_type and "local_path" in attrs and self.instance.local_path != attrs['local_path']:
errors['local_path'] = _(f'Cannot change local_path for {scm_type}-based projects') errors['local_path'] = _(f'Cannot change local_path for {scm_type}-based projects')
if scm_type: if scm_type:
attrs.pop('local_path', None) attrs.pop('local_path', None)