Skip to content

Commit 197f959

Browse files
author
James (ODSC)
authored
Merge branch 'main' into langcode
2 parents 22e5e22 + a1816d1 commit 197f959

File tree

5 files changed

+42
-31
lines changed

5 files changed

+42
-31
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
1011
### Added
1112

1213
- Add `lang` attribute to `html` tag.
1314

15+
### Fixed
16+
17+
- If a file is expired, the error message states the correct DELETE_FILES_AFTER_DAYS value, instead of the default of 7.
18+
- If a file is expired, the "file not found" exception is caught by all possible sources.
19+
1420
## [0.30.5] - 2024-09-30
1521

1622
### Added

cove/locale/en/LC_MESSAGES/django.po

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2024-09-25 21:29+0000\n"
11+
"POT-Creation-Date: 2024-10-04 15:54+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -558,22 +558,24 @@ msgid ""
558558
"Error message: {}"
559559
msgstr ""
560560

561-
#: cove/views.py:77 cove/views.py:90
561+
#: cove/views.py:77 cove/views.py:109
562562
msgid "Sorry, the page you are looking for is not available"
563563
msgstr ""
564564

565-
#: cove/views.py:79 cove/views.py:92
565+
#: cove/views.py:79 cove/views.py:111
566566
msgid "Go to Home page"
567567
msgstr ""
568568

569569
#: cove/views.py:81
570570
msgid "We don't seem to be able to find the data you requested."
571571
msgstr ""
572572

573-
#: cove/views.py:94
573+
#: cove/views.py:113
574+
#, python-format
574575
msgid ""
575576
"The data you were hoping to explore no longer exists.\n"
576577
"\n"
577578
"This is because all data supplied to this website is automatically deleted "
578-
"after 7 days, and therefore the analysis of that data is no longer available."
579+
"after %s days, and therefore the analysis of that data is no longer "
580+
"available."
579581
msgstr ""

cove/locale/es/LC_MESSAGES/django.mo

2 Bytes
Binary file not shown.

cove/locale/es/LC_MESSAGES/django.po

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgid ""
1717
msgstr ""
1818
"Project-Id-Version: PACKAGE VERSION\n"
1919
"Report-Msgid-Bugs-To: \n"
20-
"POT-Creation-Date: 2024-09-26 01:52+0000\n"
20+
"POT-Creation-Date: 2024-10-04 15:54+0000\n"
2121
"PO-Revision-Date: 2018-11-30 11:12+0000\n"
2222
"Last-Translator: Bibiana Cristòfol <[email protected]>, 2021\n"
2323
"Language-Team: Spanish (https://www.transifex.com/OpenDataServices/"
@@ -616,27 +616,29 @@ msgstr ""
616616
"\n"
617617
"Mensaje del error: {}"
618618

619-
#: cove/views.py:77 cove/views.py:90
619+
#: cove/views.py:77 cove/views.py:109
620620
msgid "Sorry, the page you are looking for is not available"
621621
msgstr "Lo sentimos, la página que está buscando no está disponible"
622622

623-
#: cove/views.py:79 cove/views.py:92
623+
#: cove/views.py:79 cove/views.py:111
624624
msgid "Go to Home page"
625625
msgstr "Ir a la Página de Inicio"
626626

627627
#: cove/views.py:81
628628
msgid "We don't seem to be able to find the data you requested."
629629
msgstr "Parece que no podemos encontrar los datos que usted solicitó."
630630

631-
#: cove/views.py:94
631+
#: cove/views.py:113
632+
#, python-format
632633
msgid ""
633634
"The data you were hoping to explore no longer exists.\n"
634635
"\n"
635636
"This is because all data supplied to this website is automatically deleted "
636-
"after 7 days, and therefore the analysis of that data is no longer available."
637+
"after %s days, and therefore the analysis of that data is no longer "
638+
"available."
637639
msgstr ""
638640
"Los datos que usted quería explorar ya no existen.\n"
639641
"\n"
640642
"Esto se debe a que todos los datos suministrados a este sitio web se borran "
641-
"automáticamente después de 7 días, y por lo tanto el análisis de esos datos "
643+
"automáticamente después de %s días, y por lo tanto el análisis de esos datos "
642644
"ya no está disponible."

cove/views.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,37 @@ def explore_data_context(request, pk, get_file_type=None):
8585
file_name = data.original_file.path
8686
if file_name.endswith('validation_errors-3.json'):
8787
raise PermissionError('You are not allowed to upload a file with this name.')
88+
89+
file_type = get_file_type(data.original_file)
90+
context = {
91+
'original_file': {
92+
'url': data.original_file.url,
93+
'size': data.original_file.size,
94+
'path': data.original_file.path,
95+
},
96+
'file_type': file_type,
97+
'file_name': get_file_name(file_name),
98+
'data_uuid': pk,
99+
'current_url': request.build_absolute_uri(),
100+
'source_url': data.source_url,
101+
'form_name': data.form_name,
102+
'created_datetime': data.created.strftime('%A, %d %B %Y %I:%M%p %Z'),
103+
'created_date': data.created.strftime('%A, %d %B %Y'),
104+
'created_time': data.created.strftime('%I:%M%p %Z'),
105+
'support_email': settings.COVE_CONFIG.get('support_email'),
106+
}
88107
except FileNotFoundError:
89108
return {}, None, render(request, 'error.html', {
90109
'sub_title': _('Sorry, the page you are looking for is not available'),
91110
'link': 'index',
92111
'link_text': _('Go to Home page'),
93112
'support_email': settings.COVE_CONFIG.get('support_email'),
94113
'msg': _('The data you were hoping to explore no longer exists.\n\nThis is because all '
95-
'data supplied to this website is automatically deleted after 7 days, and therefore '
114+
'data supplied to this website is automatically deleted after %s days, and therefore '
96115
'the analysis of that data is no longer available.')
116+
% getattr(settings, 'DELETE_FILES_AFTER_DAYS', 7)
97117
}, status=404)
98118

99-
file_type = get_file_type(data.original_file)
100-
context = {
101-
'original_file': {
102-
'url': data.original_file.url,
103-
'size': data.original_file.size,
104-
'path': data.original_file.path,
105-
},
106-
'file_type': file_type,
107-
'file_name': get_file_name(file_name),
108-
'data_uuid': pk,
109-
'current_url': request.build_absolute_uri(),
110-
'source_url': data.source_url,
111-
'form_name': data.form_name,
112-
'created_datetime': data.created.strftime('%A, %d %B %Y %I:%M%p %Z'),
113-
'created_date': data.created.strftime('%A, %d %B %Y'),
114-
'created_time': data.created.strftime('%I:%M%p %Z'),
115-
'support_email': settings.COVE_CONFIG.get('support_email'),
116-
}
117-
118119
return (context, data, None)
119120

120121

0 commit comments

Comments
 (0)