[Backport] Prevent some ObjectDoesNotExist exceptions
parent
257ed89b04
commit
48dafad8f4
|
@ -61,11 +61,12 @@ def _try_to_close_or_open_us_when_create_or_edit_task(instance):
|
||||||
def _try_to_close_or_open_us_when_delete_task(instance):
|
def _try_to_close_or_open_us_when_delete_task(instance):
|
||||||
from taiga.projects.userstories import services as us_service
|
from taiga.projects.userstories import services as us_service
|
||||||
|
|
||||||
if instance.user_story_id:
|
with suppress(ObjectDoesNotExist):
|
||||||
if us_service.calculate_userstory_is_closed(instance.user_story):
|
if instance.user_story_id:
|
||||||
us_service.close_userstory(instance.user_story)
|
if us_service.calculate_userstory_is_closed(instance.user_story):
|
||||||
else:
|
us_service.close_userstory(instance.user_story)
|
||||||
us_service.open_userstory(instance.user_story)
|
else:
|
||||||
|
us_service.open_userstory(instance.user_story)
|
||||||
|
|
||||||
|
|
||||||
# Milestone
|
# Milestone
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from contextlib import suppress
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Signals for cached prev US
|
# Signals for cached prev US
|
||||||
|
@ -87,5 +89,6 @@ def _try_to_close_or_open_milestone_when_create_or_edit_us(instance):
|
||||||
def _try_to_close_milestone_when_delete_us(instance):
|
def _try_to_close_milestone_when_delete_us(instance):
|
||||||
from taiga.projects.milestones import services as milestone_service
|
from taiga.projects.milestones import services as milestone_service
|
||||||
|
|
||||||
if instance.milestone_id and milestone_service.calculate_milestone_is_closed(instance.milestone):
|
with suppress(ObjectDoesNotExist):
|
||||||
milestone_service.close_milestone(instance.milestone)
|
if instance.milestone_id and milestone_service.calculate_milestone_is_closed(instance.milestone):
|
||||||
|
milestone_service.close_milestone(instance.milestone)
|
||||||
|
|
Loading…
Reference in New Issue