From: Magnus Hagander Date: Sun, 24 Feb 2019 11:28:51 +0000 (+0100) Subject: Don't crash when changing local domain X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=1911994db54767c019dd5f4978baee5ccccab5ac;p=pgmailmgr.git Don't crash when changing local domain Changes of local part was properly blocked with an error message. Changing the local domain was blocked but then caused an exception further down the code. This has been broken since forever, clearly not something people have tried, but of course still worth fixing. --- diff --git a/pgmailmgr/mailmgr/forms.py b/pgmailmgr/mailmgr/forms.py index 766c1f9..b541291 100644 --- a/pgmailmgr/mailmgr/forms.py +++ b/pgmailmgr/mailmgr/forms.py @@ -47,6 +47,8 @@ class VirtualUserForm(forms.ModelForm): def clean(self): if 'local_part' not in self.cleaned_data: return {} + if 'local_domain' not in self.cleaned_data: + return {} # Validate that the pattern is allowed curs = connection.cursor() @@ -100,6 +102,8 @@ class ForwarderForm(forms.ModelForm): def clean(self): if 'local_part' not in self.cleaned_data: return {} + if 'local_domain' not in self.cleaned_data: + return {} # Validate that the pattern is allowed curs = connection.cursor()