From 82104ccf847531944b32810f677cc6cc5c36ccc8 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 2 Jan 2023 15:38:42 -0800 Subject: [PATCH] email: Workaround an issue with error on finishing uninstall Showing the uninstall progress page fails during uninstall of email app. Workaround that by handling the errors raised. A better approach is to ensure that the view is not processed when uninstall operation is in progress. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/email/views.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plinth/modules/email/views.py b/plinth/modules/email/views.py index bac67c3b2..2f48354bb 100644 --- a/plinth/modules/email/views.py +++ b/plinth/modules/email/views.py @@ -25,14 +25,22 @@ class EmailAppView(AppView): def get_context_data(self, **kwargs): """Add additional context data for rendering the template.""" context = super().get_context_data(**kwargs) - context['dns_entries'] = dns.get_entries() + try: # Handle error during uninstall of app + context['dns_entries'] = dns.get_entries() + except FileNotFoundError: + pass + return context def get_initial(self): """Return the initial values to populate in the form.""" initial = super().get_initial() - domains = privileged.domain.get_domains() - initial['primary_domain'] = domains['primary_domain'] + try: # Handle error during uninstall of app + domains = privileged.domain.get_domains() + initial['primary_domain'] = domains['primary_domain'] + except FileNotFoundError: + pass + return initial def form_valid(self, form):