diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 02ef6f42646f9cc19331908ea8f707c2fe9ca0e7..9d40e165c3014e2a2c97bab60be65e776d53ec2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,12 @@ repos: - id: requirements-txt-fixer - id: end-of-file-fixer - id: mixed-line-ending + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ['--write-changes'] + exclude: '^arkindex\/(documents\/export|sql_validation)\/.*\.sql' - repo: meta hooks: - id: check-useless-excludes diff --git a/README.md b/README.md index 956b6524063f1d9f8853f53c4205ba4398a1ed4b..4096f9b9d5dff5256bbf7749c6c5153c9f6568bf 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ gitlab: ### Local image server -Arkindex splits up image URLs in their image server and the image path. For example, a IIIF server at `http://iiif.irht.cnrs.fr/iiif/` and an image at `/Paris/JJ042/1.jpg` would be represented as an ImageServer instance holding one Image. Since Arkindex has a local IIIF server for image uploads and thumbnails, a special instance of ImageServer is required to point to this local server. In local developement, this server should be available at `https://ark.localhost/iiif`. You will therefore need to create an ImageServer via the Django admin or the Django shell with this URL. To set the local server ID, you can add a custom setting in `arkindex/config.yml`: +Arkindex splits up image URLs in their image server and the image path. For example, a IIIF server at `http://iiif.irht.cnrs.fr/iiif/` and an image at `/Paris/JJ042/1.jpg` would be represented as an ImageServer instance holding one Image. Since Arkindex has a local IIIF server for image uploads and thumbnails, a special instance of ImageServer is required to point to this local server. In local development, this server should be available at `https://ark.localhost/iiif`. You will therefore need to create an ImageServer via the Django admin or the Django shell with this URL. To set the local server ID, you can add a custom setting in `arkindex/config.yml`: ```yaml local_imageserver_id: 999 diff --git a/arkindex/dataimport/api.py b/arkindex/dataimport/api.py index 1cc90ba96f2acd16088c5fd4c2d0d28c02260251..3b8044fa903d770118f393bf14adab9743b43b9c 100644 --- a/arkindex/dataimport/api.py +++ b/arkindex/dataimport/api.py @@ -888,7 +888,7 @@ class WorkerVersionList(WorkerACLMixin, ListCreateAPIView): filters = Q() if self.simple_mode: - # Limit output to versions with tags or master/main branchs + # Limit output to versions with tags or master/main branches filters = Q(revision__refs__type=GitRefType.Tag) | Q(revision__refs__type=GitRefType.Branch, revision__refs__name__in=["master", "main"]) return worker.versions \ @@ -975,7 +975,7 @@ class WorkerVersionRetrieve(RetrieveUpdateAPIView): def check_object_permissions(self, request, instance): """ Allow any user to retrieve a worker version without authentication - This behavior allows to retrieve a version information on public ressources + This behavior allows to retrieve a version information on public resources Only internal users are allowed to update a worker version """ diff --git a/arkindex/dataimport/management/commands/import_s3.py b/arkindex/dataimport/management/commands/import_s3.py index eb318c2923577151f2565d6b378c7e35e53242b3..036e23db1f8dedb4a062d2da5f226e6e822d5ada 100644 --- a/arkindex/dataimport/management/commands/import_s3.py +++ b/arkindex/dataimport/management/commands/import_s3.py @@ -73,7 +73,7 @@ class Command(BaseCommand): 'AWS_ENDPOINT': settings.AWS_ENDPOINT, 'AWS_REGION': settings.AWS_REGION } - # Assert s3 informations are passed to tasks + # Assert s3 information are passed to tasks assert env_vars['AWS_ACCESS_KEY'] and env_vars['AWS_SECRET_KEY'], ( 'S3 environment variables could not be found\n' 'Please define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY before starting import' diff --git a/arkindex/dataimport/models.py b/arkindex/dataimport/models.py index 67b9e439f23b8874a9ceeccfda2892d82d017807..cb5799427080f7bce448e53781fb062558d9d520 100644 --- a/arkindex/dataimport/models.py +++ b/arkindex/dataimport/models.py @@ -164,7 +164,7 @@ class DataImport(IndexableModel): version_id=run.version_id, parents=run.parents, configuration_id=run.configuration_id) - # Save the correspondance between this process' worker_run and the new one + # Save the correspondence between this process' worker_run and the new one new_runs[run.id] = new_run # Remap parent ids correctly @@ -279,7 +279,7 @@ class DataImport(IndexableModel): } } - # Import entities directy after import step + # Import entities directly after import step if self.build_entities: tasks['build_entities'] = { 'image': settings.ARKINDEX_TASKS_IMAGE, @@ -696,7 +696,7 @@ class WorkerActivityState(Enum): class WorkerActivity(IndexableModel): """ Many-to-many relationship between Element and WorkerVersion - Used to track the activity of a worker version among mutliple elements + Used to track the activity of a worker version among multiple elements """ # Using an UUID helps to execute SQL raw INSERT id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) diff --git a/arkindex/dataimport/providers.py b/arkindex/dataimport/providers.py index 718899a39b4dc86379607670a839951ad5a59f1d..c43d37d8f9e16bcc9f171554c920c41c6b7d8a64 100644 --- a/arkindex/dataimport/providers.py +++ b/arkindex/dataimport/providers.py @@ -211,7 +211,7 @@ class GitLabProvider(GitProvider): raise ValidationError("A repository with this URL already exists") # Determine the user's access level on this project - # When it is inherited from the group and not overriden in the project, project_access is not defined. + # When it is inherited from the group and not overridden in the project, project_access is not defined. # When the project isn't in a group, or the user is added to a specific project in a group, # group_access is not defined. project_access overrides group_access. access_level = 0 @@ -233,7 +233,7 @@ class GitLabProvider(GitProvider): provider_name=self.__class__.__name__, ) - # Create a webhook using informations from the HTTP request + # Create a webhook using information from the HTTP request self.create_hook(repo, project_id=int(id), request=request) return repo diff --git a/arkindex/dataimport/serializers/imports.py b/arkindex/dataimport/serializers/imports.py index cadeb7f46a0c7a46225ea67aa09efd494f235922..e9a3f06c43f1ba4c54586dd24f90e30b974ae877 100644 --- a/arkindex/dataimport/serializers/imports.py +++ b/arkindex/dataimport/serializers/imports.py @@ -386,7 +386,7 @@ class WorkerRunSerializer(serializers.ModelSerializer): """ parents = serializers.ListField(child=serializers.UUIDField()) worker_version_id = serializers.UUIDField(source='version_id') - # Serialize worker with its basic informations + # Serialize worker with its basic information worker = WorkerLightSerializer(source='version.worker', read_only=True) configuration_id = serializers.PrimaryKeyRelatedField(queryset=WorkerConfiguration.objects.all(), required=False, allow_null=True) @@ -454,7 +454,7 @@ class ImportTranskribusSerializer(serializers.Serializer): class CreateImportTranskribusErrorResponseSerializer(serializers.Serializer): - collection_id = serializers.CharField(required=False, help_text="Errors that occured during collection ID field validation.") + collection_id = serializers.CharField(required=False, help_text="Errors that occurred during collection ID field validation.") class ProcessElementLightSerializer(serializers.ModelSerializer): diff --git a/arkindex/dataimport/serializers/workers.py b/arkindex/dataimport/serializers/workers.py index dc62c7bb6e80efabe96341d85656ef83c792c125..ef337a8beb1c103022890d8974bfc46d90c5ceb9 100644 --- a/arkindex/dataimport/serializers/workers.py +++ b/arkindex/dataimport/serializers/workers.py @@ -46,14 +46,14 @@ class WorkerVersionSerializer(serializers.ModelSerializer): """ Serialize a worker version """ - # State defaults to created when instanciating a WorkerVersion + # State defaults to created when instantiating a WorkerVersion state = EnumField(WorkerVersionState, required=False) worker = WorkerLightSerializer(read_only=True) revision = serializers.UUIDField() element_count = serializers.IntegerField(read_only=True) gpu_usage = EnumField(WorkerVersionGPUUsage, required=False, default=WorkerVersionGPUUsage.Disabled) - # Serialize worker with its basic informations + # Serialize worker with its basic information class Meta: model = WorkerVersion fields = ( diff --git a/arkindex/dataimport/tests/test_imports.py b/arkindex/dataimport/tests/test_imports.py index bc45e9793e8d1ae818801718fd133c4c71ce9ed3..638a6e92a60cef3add4bcbfe349e347efc300ddb 100644 --- a/arkindex/dataimport/tests/test_imports.py +++ b/arkindex/dataimport/tests/test_imports.py @@ -428,7 +428,7 @@ class TestImports(FixtureAPITestCase): def test_delete_running(self): """ - It is not possible to delete a runnin import + It is not possible to delete a running import """ self.client.force_login(self.user) self.elts_process.start() @@ -1116,7 +1116,7 @@ class TestImports(FixtureAPITestCase): def test_start_process(self): """ A user can start a process with no parameters. - Defaut chunks, thumbnails and farm are used. Nor cache or workers activity is set. + Default chunks, thumbnails and farm are used. Nor cache or workers activity is set. """ dataimport2 = self.corpus.imports.create(creator=self.user, mode=DataImportMode.Workers) self.assertIsNone(dataimport2.workflow) @@ -1237,7 +1237,7 @@ class TestImports(FixtureAPITestCase): @patch('arkindex.project.triggers.dataimport_tasks.initialize_activity.delay') def test_start_process_options_requires_workers(self, activities_delay_mock, worker_runs_mock): """ - Cache and worker activity options can be trigerred when starting a process + Cache and worker activity options can be triggered when starting a process """ process = self.corpus.imports.create( creator=self.user, diff --git a/arkindex/dataimport/tests/test_workeractivity.py b/arkindex/dataimport/tests/test_workeractivity.py index 5616ef68efd7b0a6ded8887e050ddc6a8665a724..9a0377a7e6123a87e84d4bf25c36478d8a6d3526 100644 --- a/arkindex/dataimport/tests/test_workeractivity.py +++ b/arkindex/dataimport/tests/test_workeractivity.py @@ -238,7 +238,7 @@ class TestWorkerActivity(FixtureTestCase): def test_put_activity_forbidden_states(self): """ - Check state update is forbidden for some non consistant cases + Check state update is forbidden for some non consistent cases The response is a HTTP_409_CONFLICT """ queued, started, error, processed = ( diff --git a/arkindex/dataimport/tests/test_workerruns.py b/arkindex/dataimport/tests/test_workerruns.py index b1a008169516174303c7d50f91bb4ca249b4be21..860c549564374b2169505b6be7eb383a7f09f626 100644 --- a/arkindex/dataimport/tests/test_workerruns.py +++ b/arkindex/dataimport/tests/test_workerruns.py @@ -49,7 +49,7 @@ class TestWorkerRuns(FixtureAPITestCase): def test_runs_list_no_execution_right(self): """ - Worker runs attached to a process can be listed even if the user has no execution rigths to workers + Worker runs attached to a process can be listed even if the user has no execution rights to workers This is due to the fact a user can see a process running on a corpus they have access """ self.worker_1.memberships.all().delete() diff --git a/arkindex/dataimport/tests/test_workers.py b/arkindex/dataimport/tests/test_workers.py index 27f46f4eb94fd39c368fceabd69f8d3f78ec2917..ca3d81fb3cfae9b97c8b02a187a3e7f84fb3ac79 100644 --- a/arkindex/dataimport/tests/test_workers.py +++ b/arkindex/dataimport/tests/test_workers.py @@ -612,7 +612,7 @@ class TestWorkersWorkerVersions(FixtureAPITestCase): def test_retrieve_version_no_login(self): """ Worker versions may be retrieved with no authentication in order - to see the version on public ressources + to see the version on public resources """ with self.assertNumQueries(5): response = self.client.get(reverse('api:version-retrieve', kwargs={'pk': str(self.version_1.id)})) diff --git a/arkindex/documents/api/elements.py b/arkindex/documents/api/elements.py index a3852e76c7aab6cf098611f9ae6bccf1a464c96d..b93ab14ab7889df95e9c71a82adf7ba99c8ef7a8 100644 --- a/arkindex/documents/api/elements.py +++ b/arkindex/documents/api/elements.py @@ -254,7 +254,7 @@ class ElementsListAutoSchema(AutoSchema): * `lt`: Elements having a classification with a confidence strictly lower than the filter. * `lte`: Elements having a classification with a confidence lower than or equal to the filter. * `lt`: Elements having a classification with a confidence strictly greater than the filter. - * `gte`: Elements having a classification with a confidence greather than or equal to the filter. + * `gte`: Elements having a classification with a confidence greater than or equal to the filter. This requires `classification_confidence` to be set. """), @@ -870,7 +870,7 @@ class ElementChildren(ElementsListBase): @extend_schema(tags=['elements']) @extend_schema_view( - get=extend_schema(description="Retrieve a single element's informations and metadata"), + get=extend_schema(description="Retrieve a single element's information and metadata"), patch=extend_schema(description='Rename an element'), put=extend_schema(description="Edit an element's attributes. Requires a write access on the corpus."), delete=extend_schema(description='Delete an element. Requires either an admin access on the corpus, ' @@ -1130,7 +1130,7 @@ class CorpusList(ListCreateAPIView): permission_classes = (IsVerifiedOrReadOnly, ) def get_queryset(self): - # We need to prefetch the acces rights on each corpora + # We need to prefetch the access rights on each corpora accessible_corpora = filter_rights(self.request.user, Corpus, Role.Guest.value) # Keep non duplicated corpora with the max access level diff --git a/arkindex/documents/date_parser.py b/arkindex/documents/date_parser.py index 2f5635eca1c59df24317ead46df61e0f54563f82..35fe026f50a0e662d144ed7579a968a12dee4254 100644 --- a/arkindex/documents/date_parser.py +++ b/arkindex/documents/date_parser.py @@ -138,7 +138,7 @@ def instanciate_date(date_elt): Returns an unsaved interpreted date from a dictionary containing at least a type (documents.models.DateType) and a year (int) """ - assert isinstance(date_elt, dict), 'A dictionnary is required to instanciate InterpretedDate' + assert isinstance(date_elt, dict), 'A dictionary is required to instantiate InterpretedDate' date = InterpretedDate(**date_elt) try: date.validate() diff --git a/arkindex/documents/deletion.py b/arkindex/documents/deletion.py index 560215e72007304ea84e14511476c1f994c8326d..ab33ba26ffa9fa11bc731c2d2f49b0e00abf724b 100644 --- a/arkindex/documents/deletion.py +++ b/arkindex/documents/deletion.py @@ -11,7 +11,7 @@ def delete_element(element_id: UUID) -> None: with connections['default'].cursor() as cursor: # Remove transcription-entity links cursor.execute(""" - DELETE FROM documents_transcriptionentity te WHERE transcription_id IN ( + DELETE FROM documents_transcriptionentity WHERE transcription_id IN ( SELECT t.id FROM documents_transcription t LEFT JOIN documents_elementpath elementpath USING (element_id) WHERE t.element_id = %(id)s OR elementpath.path && ARRAY[%(id)s] diff --git a/arkindex/documents/migrations/0006_preflight.py b/arkindex/documents/migrations/0006_preflight.py index 9690eeca21a2410d22b634c1645f6f8ddc77eb79..8266824a1927d868403089abdafe28db7c5dc3c8 100644 --- a/arkindex/documents/migrations/0006_preflight.py +++ b/arkindex/documents/migrations/0006_preflight.py @@ -9,7 +9,7 @@ class Migration(migrations.Migration): operations = [ # Remove extra regions tied to several elements - # We cant to keep the first region element item to preserve the link + # We can't to keep the first region element item to preserve the link # for the followup migration migrations.RunSQL( """ diff --git a/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py b/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py index 3c163537ad6ca369f43daecd1ea7cea8a8327996..bf3edc6a04a64ba1b77fc16e0a552d0220a323cb 100644 --- a/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py +++ b/arkindex/documents/migrations/0034_transcriptionentity_worker_version.py @@ -33,10 +33,10 @@ class Migration(migrations.Migration): ), migrations.RunSQL( """ - UPDATE documents_transcriptionentity te + UPDATE documents_transcriptionentity tr_entity SET worker_version_id = entity.worker_version_id FROM documents_entity entity - WHERE te.entity_id = entity.id; + WHERE tr_entity.entity_id = entity.id; """, reverse_sql=migrations.RunSQL.noop, elidable=True, diff --git a/arkindex/documents/serializers/entities.py b/arkindex/documents/serializers/entities.py index 7513b47010b3c93512aa6cf100fa6c1f1bf1d4b1..37253b639b608123ffa8e933c7d13ddf7841eee7 100644 --- a/arkindex/documents/serializers/entities.py +++ b/arkindex/documents/serializers/entities.py @@ -66,7 +66,7 @@ class EntityRoleSerializer(serializers.ModelSerializer): class CreateEntityRoleErrorResponseSerializer(serializers.Serializer): id = serializers.UUIDField(required=False, help_text="The corpus ID.") - corpus = serializers.ListField(child=serializers.CharField(), required=False, help_text="Errors that occured during corpus ID field validation.") + corpus = serializers.ListField(child=serializers.CharField(), required=False, help_text="Errors that occurred during corpus ID field validation.") class EntityLinkSerializer(serializers.ModelSerializer): @@ -252,7 +252,7 @@ class TranscriptionEntitySerializer(serializers.ModelSerializer): class TranscriptionEntityDetailsSerializer(TranscriptionEntitySerializer): """ - Serialize the link between a transcription and a detailled entity + Serialize the link between a transcription and a detailed entity """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/arkindex/documents/serializers/ml.py b/arkindex/documents/serializers/ml.py index a5e6593a78563c56c646040d960009efea066006..e93aa75c35ee6b2c1c2bd7c0bb8a590d4f99c345 100644 --- a/arkindex/documents/serializers/ml.py +++ b/arkindex/documents/serializers/ml.py @@ -236,7 +236,7 @@ class TranscriptionSerializer(serializers.ModelSerializer): class ElementTranscriptionSerializer(TranscriptionSerializer): """ - Serialises a transcription with its element basic informations (e.g. image zone) + Serialises a transcription with its element basic information (e.g. image zone) """ element = ElementZoneSerializer(allow_null=True) @@ -294,7 +294,7 @@ class TranscriptionCreateSerializer(serializers.ModelSerializer): user = self.context['request'].user if (not user or not user.is_internal): errors['worker_version'] = [ - 'An internal user is required to create a transcription refering to a worker_version' + 'An internal user is required to create a transcription referring to a worker_version' ] if not ('score' in data) ^ ('confidence' in data): @@ -362,7 +362,7 @@ class ElementTranscriptionsBulkSerializer(serializers.Serializer): return_elements = serializers.BooleanField( default=False, help_text=( - 'Return a list of annotations containing an `element` field with basic element informations ' + 'Return a list of annotations containing an `element` field with basic element information ' 'and a `created` field specifying if the element has been created for the annotation. ' 'Elements are ordered corresponding to the `transcriptions` field and may be duplicated.' ) diff --git a/arkindex/documents/tests/test_corpus_elements.py b/arkindex/documents/tests/test_corpus_elements.py index db9c72337141420a8f255565b3bd72d575d083e0..f4f19c6ba9f223528c1a427b8bbf59d1d19b0286 100644 --- a/arkindex/documents/tests/test_corpus_elements.py +++ b/arkindex/documents/tests/test_corpus_elements.py @@ -141,7 +141,7 @@ class TestListElements(FixtureAPITestCase): """ Ensure the corpus filter allows any UUID, not just version 4 UUIDs. Using the version=x argument on uuid.UUID causes the version and variant bits - of a UUID to be changed on instanciation; since we generate v4 RFC 4122-compliant UUIDs, + of a UUID to be changed on instantiation; since we generate v4 RFC 4122-compliant UUIDs, this would work in most cases - but we could have any UUID version or variant, generated by some other tool, which would cause strange 404 errors. """ diff --git a/arkindex/documents/tests/test_create_transcriptions.py b/arkindex/documents/tests/test_create_transcriptions.py index 5e21010034cc47f4801fe6c8b12a2ae4b131581d..339842949e5b9bedc419083a22dcd8c3806b802e 100644 --- a/arkindex/documents/tests/test_create_transcriptions.py +++ b/arkindex/documents/tests/test_create_transcriptions.py @@ -164,7 +164,7 @@ class TestTranscriptionCreate(FixtureAPITestCase): self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertDictEqual(response.json(), { 'worker_version': [ - 'An internal user is required to create a transcription refering to a worker_version' + 'An internal user is required to create a transcription referring to a worker_version' ] }) diff --git a/arkindex/images/serializers.py b/arkindex/images/serializers.py index 6e01e9e839bf310050ab6c1d840db1b320b67f06..52b088d1607342c4a6fb372184d8c329dbd78749 100644 --- a/arkindex/images/serializers.py +++ b/arkindex/images/serializers.py @@ -262,7 +262,7 @@ class ZoneLightSerializer(serializers.ModelSerializer): class ZoneSerializer(ZoneLightSerializer): """ - Serialize a complete zone with its computed center, url and image informations + Serialize a complete zone with its computed center, url and image information """ # Override the field to fully serialize the image image = ImageSerializer() diff --git a/arkindex/project/mixins.py b/arkindex/project/mixins.py index 0c35e92498a0319f4fdc3f839c43780466647bd7..1f6be3eaa647c9cb1c65b129718c1c7f1d0a467e 100644 --- a/arkindex/project/mixins.py +++ b/arkindex/project/mixins.py @@ -45,7 +45,7 @@ class ACLMixin(object): return instance.memberships.filter( Q( - # Right direcly owned by this user + # Right directly owned by this user Q(user=self.user) & Q(level__gte=level) ) diff --git a/arkindex/project/pagination.py b/arkindex/project/pagination.py index 3e184300ab93571002fc7dc8a1b9ecbecc761152..c0e1d35943f5495a1b161632bfa4f3448b834887 100644 --- a/arkindex/project/pagination.py +++ b/arkindex/project/pagination.py @@ -40,7 +40,7 @@ class LargePageNumberPagination(PageNumberPagination): class CustomCursorPagination(pagination.CursorPagination): """ A custom cursor pagination class - Count attribute and ordering may be updated when instanciating the class + Count attribute and ordering may be updated when instantiating the class """ count = None page_size = 20 diff --git a/arkindex/project/tests/test_acl_mixin.py b/arkindex/project/tests/test_acl_mixin.py index 388b6cfb33c4f80f7912a3db8e70e1b8b6a40929..87e69d31bcb050505109bb1990b6b8f274d8800c 100644 --- a/arkindex/project/tests/test_acl_mixin.py +++ b/arkindex/project/tests/test_acl_mixin.py @@ -234,7 +234,7 @@ class TestACLMixin(FixtureTestCase): ) def test_super_admin_readable_corpora(self): - # A super admin should retrieve all existing corpora with Admin rigths + # A super admin should retrieve all existing corpora with Admin rights corpus_acl_mixin = CorpusACLMixin(user=self.superuser) with self.assertNumQueries(1): corpora = list(corpus_acl_mixin.readable_corpora) @@ -254,7 +254,7 @@ class TestACLMixin(FixtureTestCase): ) def test_corpus_right_and_public(self): - # User specific rigths should be returned instead of the the defaults access for public rigths + # User specific rights should be returned instead of the the defaults access for public rights Right.objects.create(user=self.user3, content_object=self.corpus, level=42) corpus_acl_mixin = CorpusACLMixin(user=self.user3) with self.assertNumQueries(2): diff --git a/arkindex/sql_validation/element_dot_delete.sql b/arkindex/sql_validation/element_dot_delete.sql index 32a41d51ec8fcbb840f9b1ed6b7169f190f577de..adda6939a20349c7a355f724842639196be244a9 100644 --- a/arkindex/sql_validation/element_dot_delete.sql +++ b/arkindex/sql_validation/element_dot_delete.sql @@ -1,4 +1,4 @@ -DELETE FROM documents_transcriptionentity te WHERE transcription_id IN ( +DELETE FROM documents_transcriptionentity WHERE transcription_id IN ( SELECT t.id FROM documents_transcription t LEFT JOIN documents_elementpath elementpath USING (element_id) WHERE t.element_id = '{id}'::uuid OR elementpath.path && ARRAY['{id}'::uuid] diff --git a/arkindex/users/api.py b/arkindex/users/api.py index f52fef7a6ef10b07c91dc3170538e78d0155ef8f..f64a62f200982490e17ffb4d7cc5168f98d68b36 100644 --- a/arkindex/users/api.py +++ b/arkindex/users/api.py @@ -673,7 +673,7 @@ class MembershipDetails(ACLMixin, RetrieveUpdateDestroyAPIView): if not access_level or access_level < Role.Guest.value: raise NotFound - # Allow any guest to retrieve informations + # Allow any guest to retrieve information if self.request.method in SAFE_METHODS: return diff --git a/arkindex/users/models.py b/arkindex/users/models.py index aad579d8b1ba0a410a96653e596343991eafb114..cd4707ebd1805dcf66573088cc277e30c92f3a1c 100644 --- a/arkindex/users/models.py +++ b/arkindex/users/models.py @@ -21,7 +21,7 @@ class Role(Enum): class Right(models.Model): """ - Defines an access right for users and groups to a generic targed. + Defines an access right for users and groups to a generic target. """ id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False) diff --git a/arkindex/users/serializers.py b/arkindex/users/serializers.py index 613d53fca1b354752f142a9e7a4088dad2459b30..0df1bfb1721de622eb3bdacb190d4a8e2959a657 100644 --- a/arkindex/users/serializers.py +++ b/arkindex/users/serializers.py @@ -141,7 +141,7 @@ class NewUserSerializer(serializers.ModelSerializer): def validate(self, data): data = super().validate(data) - # Instanciate user to validate password + # Instantiate user to validate password user = User(**data) return validate_user_password(user, data) @@ -415,7 +415,7 @@ class MembershipCreateSerializer(MembershipSerializer): if not access_level or access_level < Role.Admin.value: raise ValidationError({'content_id': ['Only members with an admin privilege are allowed to add other members.']}) - # Special restriction for group memerships + # Special restriction for group memberships if content_model is Group and group_id is not None: raise ValidationError({'group_id': ['It is not possible to create a membership between two groups.']}) diff --git a/arkindex/users/tests/test_generic_memberships.py b/arkindex/users/tests/test_generic_memberships.py index 6df7da6fdcdd5a1280c2c88d0b505adb076919fa..59eb38910bc06f0a3c03651c952c7b71e9146e05 100644 --- a/arkindex/users/tests/test_generic_memberships.py +++ b/arkindex/users/tests/test_generic_memberships.py @@ -307,7 +307,7 @@ class TestMembership(FixtureAPITestCase): def test_retrieve_group_no_member(self): """ - A non memeber of a group may not retrieve its details, even if it is public + A non member of a group may not retrieve its details, even if it is public """ self.client.force_login(self.user) with self.assertNumQueries(5): @@ -773,7 +773,7 @@ class TestMembership(FixtureAPITestCase): def test_retrieve_membership_not_found(self): """ - Only memberships on groups the user has a read acces can be retrieved + Only memberships on groups the user has a read access can be retrieved """ hidden_group = Group.objects.create(name='Hidden group', public=False) hidden_member = hidden_group.add_member(user=self.admin, level=Role.Guest.value)