From 8e1b4fbbaf476f8726ccf7e07e31282b9d7b5fc2 Mon Sep 17 00:00:00 2001 From: "pierre-francois.duc" Date: Mon, 22 Apr 2024 22:07:29 +0200 Subject: [PATCH 1/3] Remove the BOM if present https://docs.python.org/3/library/codecs.html#encodings-and-unicode --- app/projects/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/projects/helpers.py b/app/projects/helpers.py index cecc0b8d7..cd08667f6 100644 --- a/app/projects/helpers.py +++ b/app/projects/helpers.py @@ -544,7 +544,7 @@ def parse_input_timeseries(timeseries_file): pass else: - timeseries_file_str = timeseries_file.read().decode("utf-8") + timeseries_file_str = timeseries_file.read().decode("utf-8-sig") if timeseries_file_str != "": if timeseries_file.name.endswith("json"): From 0187a46b4b1be7db549de9b8879c242872730738 Mon Sep 17 00:00:00 2001 From: "pierre-francois.duc" Date: Mon, 22 Apr 2024 22:08:23 +0200 Subject: [PATCH 2/3] Add error message when file parsing fails --- app/projects/forms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/projects/forms.py b/app/projects/forms.py index fa49e847a..a69207666 100644 --- a/app/projects/forms.py +++ b/app/projects/forms.py @@ -834,7 +834,11 @@ def clean_input_timeseries(self): except TypeError as e: raise ValidationError(str(e)) except Exception as ex: - raise ValidationError(_("Could not parse a file. Did you upload one?")) + raise ValidationError( + _( + f"Could not parse a file due to the following error: {ex}. Did you upload a file?" + ) + ) def clean_efficiency_multiple(self): data = self.cleaned_data["efficiency_multiple"] From b7768b006752b0b00b82f8ef23c261902cb178fc Mon Sep 17 00:00:00 2001 From: "pierre-francois.duc" Date: Mon, 22 Apr 2024 22:12:50 +0200 Subject: [PATCH 3/3] Let user know that the activation link might end up in spam --- app/users/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/users/views.py b/app/users/views.py index 48cf77b97..09df360bf 100644 --- a/app/users/views.py +++ b/app/users/views.py @@ -48,7 +48,9 @@ def signup(request): send_email_exchange(to_email=to_email, subject=subject, message=message) messages.info( request, - _("Please confirm your email address to complete the registration"), + _( + "Please confirm your email address to complete the registration (note that the registration email may land in your spam box, if your email provider does not trust our domain name, we have unfortunately no control on our users' email provider)" + ), ) return redirect("home") else: