Geometry race condition fix
* fixes race condition for geometry conflict and parcel calculation * harmonizes empty geometries from None/MultiPolygonEmpty to MultiPolygonEmpty
This commit is contained in:
@@ -263,9 +263,6 @@ class NewInterventionForm(BaseForm):
|
||||
handler=handler,
|
||||
)
|
||||
|
||||
# Process the geometry form
|
||||
geometry = geom_form.save(action)
|
||||
|
||||
# Finally create main object, holding the other objects
|
||||
intervention = Intervention.objects.create(
|
||||
identifier=identifier,
|
||||
@@ -273,7 +270,6 @@ class NewInterventionForm(BaseForm):
|
||||
responsible=responsibility_data,
|
||||
legal=legal_data,
|
||||
created=action,
|
||||
geometry=geometry,
|
||||
comment=comment,
|
||||
)
|
||||
|
||||
@@ -282,6 +278,12 @@ class NewInterventionForm(BaseForm):
|
||||
|
||||
# Add the performing user as the first user having access to the data
|
||||
intervention.share_with_user(user)
|
||||
|
||||
# Process the geometry form (NOT ATOMIC TRANSACTION DUE TO CELERY!)
|
||||
geometry = geom_form.save(action)
|
||||
intervention.geometry = geometry
|
||||
intervention.save()
|
||||
|
||||
return intervention
|
||||
|
||||
|
||||
@@ -370,9 +372,6 @@ class EditInterventionForm(NewInterventionForm):
|
||||
|
||||
user_action = self.instance.mark_as_edited(user, edit_comment=EDITED_GENERAL_DATA)
|
||||
|
||||
geometry = geom_form.save(user_action)
|
||||
self.instance.geometry = geometry
|
||||
|
||||
self.instance.log.add(user_action)
|
||||
|
||||
self.instance.identifier = identifier
|
||||
@@ -381,5 +380,10 @@ class EditInterventionForm(NewInterventionForm):
|
||||
self.instance.modified = user_action
|
||||
self.instance.save()
|
||||
|
||||
# Process the geometry form (NOT ATOMIC TRANSACTION DUE TO CELERY!)
|
||||
geometry = geom_form.save(user_action)
|
||||
self.instance.geometry = geometry
|
||||
self.instance.save()
|
||||
|
||||
return self.instance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user