Skip to content

Commit

Permalink
Merge pull request #50 from kartoza/fix-post-save-input-layer
Browse files Browse the repository at this point in the history
disable post save signal in input_layer
  • Loading branch information
danangmassandy authored Jun 12, 2024
2 parents d0e2852 + a47111b commit 4bc90ab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
10 changes: 0 additions & 10 deletions django_project/cplus_api/models/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from django.conf import settings
from django.utils import timezone
from django.core.files.storage import storages, FileSystemStorage
from django.db.models.signals import post_save
from django.dispatch import receiver


COMMON_LAYERS_DIR = 'common_layers'
Expand Down Expand Up @@ -211,14 +209,6 @@ def fix_layer_metadata(self):
self.save(update_fields=['file'])


@receiver(post_save, sender=InputLayer)
def input_layer_post_save(sender, instance: InputLayer,
created, *args, **kwargs):
from cplus_api.tasks.verify_input_layer import verify_input_layer
if not created:
verify_input_layer.delay(instance.id)


class OutputLayer(BaseLayer):

is_final_output = models.BooleanField(
Expand Down
6 changes: 1 addition & 5 deletions django_project/cplus_api/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from botocore.exceptions import ClientError
from collections import OrderedDict
from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import post_save
from django.test import TestCase, TransactionTestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from rest_framework.test import APIRequestFactory
Expand All @@ -15,8 +14,7 @@
from django.core.files.storage import storages
from cplus_api.models.layer import (
InputLayer,
OutputLayer,
input_layer_post_save
OutputLayer
)


Expand Down Expand Up @@ -123,8 +121,6 @@ def init_test_data(self):
)
self.scenario_task_ct = ContentType.objects.get(
app_label="cplus_api", model="scenariotask")
# disable input layer post save
post_save.disconnect(input_layer_post_save, sender=InputLayer)

def cleanup(self):
"""Delete storage used in default and minio."""
Expand Down

0 comments on commit 4bc90ab

Please sign in to comment.