From 7d794b98d683e569e3525c6d55ac07e2aeb6ee00 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 25 Oct 2011 09:25:00 +0200 Subject: don't die on db operation at import --- src/meetingtools/apps/room/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index c09556b..4b85c12 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -242,8 +242,12 @@ def _import_room(request,acc,r): room = Room.objects.get(sco_id=r['sco_id'],acc=acc) except ObjectDoesNotExist: if r['folder_sco_id']: - room = Room.objects.create(sco_id=r['sco_id'],acc=acc,creator=request.user,folder_sco_id=r['folder_sco_id']) - + try: + room = Room.objects.create(sco_id=r['sco_id'],acc=acc,creator=request.user,folder_sco_id=r['folder_sco_id']) + except Exception,e: + room = None + pass + if not room: return None -- cgit v1.1