diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51bdc21217f2395e24a4c0735d1ef42ca8719e76..3a88df443d5ddaad1b37645d2578900cf46fc7aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ include: # For jobs that run backend scripts directly .backend-setup: - image: registry.gitlab.com/teklia/arkindex/backend/base:django-4.0.4 + image: registry.gitlab.com/teklia/arkindex/backend/base:django-4.1.4 cache: paths: diff --git a/Dockerfile b/Dockerfile index f14d885de2e0d2aba55e528e6bc1a60b0e7663ae..922b2d6223cb6f53287772cfff3dad6552dc2aa4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.0.4 as build +FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.1.4 as build RUN mkdir build ADD . build RUN cd build && python3 setup.py sdist -FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.0.4 +FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.1.4 ARG PONOS_BRANCH=master ARG PONOS_ID=10017043 ARG TRANSKRIBUS_BRANCH=master diff --git a/Dockerfile.binary b/Dockerfile.binary index 9eb9efb0700f7eefd7f525bfdfd7b9a57050c689..04b1639f9de5982b088ee5de81deb1fde4c278fb 100644 --- a/Dockerfile.binary +++ b/Dockerfile.binary @@ -60,7 +60,7 @@ RUN python -m nuitka \ arkindex/manage.py # Start over from a clean setup -FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.0.4 as build +FROM registry.gitlab.com/teklia/arkindex/backend/base:django-4.1.4 as build # Import files from compilation RUN mkdir /usr/share/arkindex diff --git a/arkindex/documents/__init__.py b/arkindex/documents/__init__.py index f455a859c40ec96cb3c4dd81080c5075499078a9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/arkindex/documents/__init__.py +++ b/arkindex/documents/__init__.py @@ -1 +0,0 @@ -default_app_config = 'arkindex.documents.apps.DocumentsConfig' diff --git a/arkindex/images/serializers.py b/arkindex/images/serializers.py index 050d6dd1875db19ef5bb6c7c3ace64b9d58eee1b..52c21741d06b8757f828c706d725720b0f27749f 100644 --- a/arkindex/images/serializers.py +++ b/arkindex/images/serializers.py @@ -190,12 +190,10 @@ class ImagePathDefault(object): Required because the implicit UniqueTogetherValidator in the Image serializer requires both server and path to either be required or have a default value. """ + requires_context = True - def set_context(self, serializer_field): - self.serializer = serializer_field.parent - - def __call__(self): - return str(self.serializer.fields['id'].default) + def __call__(self, serializer_field): + return str(serializer_field.parent.fields['id'].default) class ImageUploadSerializer(ImageSerializer): diff --git a/arkindex/process/__init__.py b/arkindex/process/__init__.py index fc4bfc3f7cef8825210bf17d1c6ab7d8ce4c66e0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/arkindex/process/__init__.py +++ b/arkindex/process/__init__.py @@ -1 +0,0 @@ -default_app_config = 'arkindex.process.apps.ProcessConfig' diff --git a/arkindex/project/aws.py b/arkindex/project/aws.py index 0e97f1325c88316f5662841dc1926d92c77f82eb..3485e9e28c55b8a855d4348ad2ff1970bf4e6258 100644 --- a/arkindex/project/aws.py +++ b/arkindex/project/aws.py @@ -92,7 +92,7 @@ class S3FileMixin(object): return return s3.Object(self.s3_bucket, self.s3_key) - s3_object = cached_property(get_s3_object, name='s3_object') + s3_object = cached_property(get_s3_object) s3_region = settings.AWS_REGION @property diff --git a/arkindex/project/settings.py b/arkindex/project/settings.py index 7e79e251b4a23183f62293041f7cd2ed852fe789..618b3f6a9668c3460ce1efe6a27669d95e7ab2ad 100644 --- a/arkindex/project/settings.py +++ b/arkindex/project/settings.py @@ -89,6 +89,17 @@ DEBUG = ARKINDEX_ENV == 'dev' # Run all system checks when starting the server ALL_CHECKS = os.environ.get('ALL_CHECKS') == 'true' or 'runserver' in sys.argv +SILENCED_SYSTEM_CHECKS = [ + # The metadata_numeric_values check constraint uses raw SQL to validate that the value + # can be cast into a float by PostgreSQL. This causes Django to show a warning as raw SQL + # expressions cannot be checked in Model.full_clean, and this will cause HTTP 500 errors + # in Django forms using MetaData. We only have forms in the Django admin, and MetaData + # can be edited just fine in the API, so this does not affect us much. + # Silenced in https://gitlab.com/teklia/arkindex/backend/-/merge_requests/1719 + # Will be fixed in https://gitlab.com/teklia/arkindex/backend/-/issues/1001 + 'models.W045', +] + # Required for django-debug-toolbar INTERNAL_IPS = ['127.0.0.1', '127.0.1.1'] @@ -184,8 +195,6 @@ TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = True - USE_TZ = True diff --git a/arkindex/project/tests/test_argparse.py b/arkindex/project/tests/test_argparse.py index 20fefbec77bba5539434fe5b3d86fe1384ec4fbc..ee806455aa6a7896ad9eff1d4f54e289aa2fa7fa 100644 --- a/arkindex/project/tests/test_argparse.py +++ b/arkindex/project/tests/test_argparse.py @@ -26,7 +26,7 @@ class TestArgparseHelpers(FixtureTestCase): def test_corpus_argument_many(self): arg = CorpusArgument(many=True) result = arg('tests') - self.assertQuerysetEqual(result, [repr(self.corpus), ]) + self.assertQuerysetEqual(result, [self.corpus, ]) def test_corpus_argument_not_found(self): arg = CorpusArgument() @@ -61,7 +61,7 @@ class TestArgparseHelpers(FixtureTestCase): def test_element_argument_many(self): arg = ElementArgument(type__folder=True, many=True) result = arg('volume 1') - self.assertQuerysetEqual(result, [repr(self.vol), ]) + self.assertQuerysetEqual(result, [self.vol, ]) def test_element_argument_multiple(self): arg = ElementArgument() diff --git a/arkindex/sql_validation/corpus_right_access.sql b/arkindex/sql_validation/corpus_right_access.sql index 3f0c521720ca4cfd09f8cae47fd7dc2a696d9c75..b2d43047679e43746fe918b08286cf7e16c0ef58 100644 --- a/arkindex/sql_validation/corpus_right_access.sql +++ b/arkindex/sql_validation/corpus_right_access.sql @@ -14,7 +14,7 @@ WHERE ("django_content_type"."app_label" = 'users' AND "django_content_type"."model" = 'group') LIMIT 21; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "users_right" LEFT OUTER JOIN "users_group" ON ("users_right"."group_id" = "users_group"."id") LEFT OUTER JOIN "users_right" T5 ON ("users_group"."id" = T5."content_id" diff --git a/arkindex/sql_validation/element_move_with_children.sql b/arkindex/sql_validation/element_move_with_children.sql index f9425214d739aeb5381ed8d763344d60a81c244e..7016a3edc97569fd4237a4e40ad1441a3fe5d5f2 100644 --- a/arkindex/sql_validation/element_move_with_children.sql +++ b/arkindex/sql_validation/element_move_with_children.sql @@ -7,13 +7,13 @@ WHERE "documents_element"."id" IN SAVEPOINT "{savepoints[0]}"; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_elementpath" WHERE ("documents_elementpath"."element_id" = '{source_id}'::uuid AND "documents_elementpath"."path"[array_length("documents_elementpath"."path", 1)] = '{parent_id}'::uuid) LIMIT 1; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_elementpath" WHERE ("documents_elementpath"."element_id" = '{source_id}'::uuid AND NOT ("documents_elementpath"."path"[array_length("documents_elementpath"."path", 1)] = '{parent_id}'::uuid)) diff --git a/arkindex/sql_validation/element_move_without_child.sql b/arkindex/sql_validation/element_move_without_child.sql index 306605e8cb638437364cecb7d1a2d5d777729d8b..017a79576bf14a9a08253d18e824c3735ebe1cec 100644 --- a/arkindex/sql_validation/element_move_without_child.sql +++ b/arkindex/sql_validation/element_move_without_child.sql @@ -7,13 +7,13 @@ WHERE "documents_element"."id" IN SAVEPOINT "{savepoints[0]}"; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_elementpath" WHERE ("documents_elementpath"."element_id" = '{source_id}'::uuid AND "documents_elementpath"."path"[array_length("documents_elementpath"."path", 1)] = '{parent_id}'::uuid) LIMIT 1; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_elementpath" WHERE ("documents_elementpath"."element_id" = '{source_id}'::uuid AND NOT ("documents_elementpath"."path"[array_length("documents_elementpath"."path", 1)] = '{parent_id}'::uuid)) diff --git a/arkindex/sql_validation/process_elements_filter_type.sql b/arkindex/sql_validation/process_elements_filter_type.sql index 65544a283beef044f4f57a226d4e459fedca98a3..7a31d9e79d52c7c5d9e5d2589eda0b8ebda8203a 100644 --- a/arkindex/sql_validation/process_elements_filter_type.sql +++ b/arkindex/sql_validation/process_elements_filter_type.sql @@ -56,7 +56,7 @@ FROM "documents_corpus" WHERE "documents_corpus"."id" = '{corpus_id}'::uuid LIMIT 21; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_element" INNER JOIN "process_processelement" ON ("documents_element"."id" = "process_processelement"."element_id") WHERE "process_processelement"."process_id" = '{process_id}'::uuid diff --git a/arkindex/sql_validation/process_elements_top_level.sql b/arkindex/sql_validation/process_elements_top_level.sql index 72ff6bbbaa68d7cc1cc612b670f69a62e019af00..32b20e910c5fabd319033ec94ce75fa39d06f98f 100644 --- a/arkindex/sql_validation/process_elements_top_level.sql +++ b/arkindex/sql_validation/process_elements_top_level.sql @@ -56,7 +56,7 @@ FROM "documents_corpus" WHERE "documents_corpus"."id" = '{corpus_id}'::uuid LIMIT 21; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_element" INNER JOIN "process_processelement" ON ("documents_element"."id" = "process_processelement"."element_id") WHERE "process_processelement"."process_id" = '{process_id}'::uuid diff --git a/arkindex/sql_validation/process_elements_with_image.sql b/arkindex/sql_validation/process_elements_with_image.sql index 135982d32b90cadea65d9cbbc11e0b5a78a5aded..c82ac3290ac490ce26ac948ba69bc86afacf187c 100644 --- a/arkindex/sql_validation/process_elements_with_image.sql +++ b/arkindex/sql_validation/process_elements_with_image.sql @@ -56,7 +56,7 @@ FROM "documents_corpus" WHERE "documents_corpus"."id" = '{corpus_id}'::uuid LIMIT 21; -SELECT (1) AS "a" +SELECT 1 AS "a" FROM "documents_element" INNER JOIN "process_processelement" ON ("documents_element"."id" = "process_processelement"."element_id") WHERE "process_processelement"."process_id" = '{process_id}'::uuid diff --git a/arkindex/users/__init__.py b/arkindex/users/__init__.py index 1cfa95c54f731514492b24b6b1b118c88e120e07..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/arkindex/users/__init__.py +++ b/arkindex/users/__init__.py @@ -1 +0,0 @@ -default_app_config = 'arkindex.users.apps.UsersConfig' diff --git a/base/requirements.txt b/base/requirements.txt index 18da32f978d8928bbd6ea9fafadfe0323b754e64..5ea2b7f0ae4fa1db0489b02748793b81804d14bd 100644 --- a/base/requirements.txt +++ b/base/requirements.txt @@ -1,5 +1,5 @@ boto3==1.18.13 cryptography==3.4.7 -Django==4.0.4 +Django==4.1.4 lxml==4.6.3 psycopg2-binary==2.9.1