瀏覽代碼

Calendar: Manage not found cases

Bastien Sevajol (Algoo) 8 年之前
父節點
當前提交
a0b6d4cdcc
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      tracim/tracim/lib/calendar.py

+ 5 - 1
tracim/tracim/lib/calendar.py 查看文件

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
         """