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
 import transaction
4
 import transaction
5
 
5
 
6
 from icalendar import Event as iCalendarEvent
6
 from icalendar import Event as iCalendarEvent
7
+from sqlalchemy.orm.exc import NoResultFound
7
 
8
 
8
 from tracim.lib.content import ContentApi
9
 from tracim.lib.content import ContentApi
9
 from tracim.lib.exceptions import UnknownCalendarType
10
 from tracim.lib.exceptions import UnknownCalendarType
115
         except UnknownCalendarType as exc:
116
         except UnknownCalendarType as exc:
116
             raise NotFound(str(exc))
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
     def get_calendar(self, type: str, id: str, path: str) -> Calendar:
124
     def get_calendar(self, type: str, id: str, path: str) -> Calendar:
121
         """
125
         """