Browse Source

Calendar: Manage not found cases

Bastien Sevajol (Algoo) 8 years ago
parent
commit
a0b6d4cdcc
1 changed files with 5 additions and 1 deletions
  1. 5 1
      tracim/tracim/lib/calendar.py

+ 5 - 1
tracim/tracim/lib/calendar.py View File

@@ -4,6 +4,7 @@ import re
4 4
 import transaction
5 5
 
6 6
 from icalendar import Event as iCalendarEvent
7
+from sqlalchemy.orm.exc import NoResultFound
7 8
 
8 9
 from tracim.lib.content import ContentApi
9 10
 from tracim.lib.exceptions import UnknownCalendarType
@@ -115,7 +116,10 @@ class CalendarManager(object):
115 116
         except UnknownCalendarType as exc:
116 117
             raise NotFound(str(exc))
117 118
 
118
-        return self.get_calendar(type, id, path)
119
+        try:
120
+            return self.get_calendar(type, id, path)
121
+        except NoResultFound as exc:
122
+            raise NotFound(str(exc))
119 123
 
120 124
     def get_calendar(self, type: str, id: str, path: str) -> Calendar:
121 125
         """