Guénaël Muller 7 years ago
parent
commit
f21ad8c9c5
1 changed files with 9 additions and 9 deletions
  1. 9 9
      tracim/tracim/controllers/events.py

+ 9 - 9
tracim/tracim/controllers/events.py View File

7
 from tracim.lib.user import UserApi
7
 from tracim.lib.user import UserApi
8
 from tracim.model.data import ContentType
8
 from tracim.model.data import ContentType
9
 
9
 
10
-class EventsRestController(RestController):
11
 
10
 
11
+class EventsRestController(RestController):
12
 
12
 
13
     @tg.expose('json')
13
     @tg.expose('json')
14
     def post(self):
14
     def post(self):
20
         if 'token' in json and json['token'] == cfg.EMAIL_REPLY_TOKEN:
20
         if 'token' in json and json['token'] == cfg.EMAIL_REPLY_TOKEN:
21
             if 'user_mail' not in json or 'content_id' not in json:
21
             if 'user_mail' not in json or 'content_id' not in json:
22
                 return {'status': 'error',
22
                 return {'status': 'error',
23
-                        'error': 'bad json',}
23
+                        'error': 'bad json', }
24
             uapi = UserApi(None)
24
             uapi = UserApi(None)
25
             # TODO support Empty result error
25
             # TODO support Empty result error
26
             try:
26
             try:
27
                 user = uapi.get_one_by_email(json['user_mail'])
27
                 user = uapi.get_one_by_email(json['user_mail'])
28
-            except NoResultFound :
28
+            except NoResultFound:
29
                 return {'status': 'error',
29
                 return {'status': 'error',
30
-                        'error': 'bad user mail',}
30
+                        'error': 'bad user mail', }
31
             api = ContentApi(user)
31
             api = ContentApi(user)
32
 
32
 
33
             try:
33
             try:
34
                 thread = api.get_one(json['content_id'],
34
                 thread = api.get_one(json['content_id'],
35
                                      content_type=ContentType.Any)
35
                                      content_type=ContentType.Any)
36
-            except NoResultFound :
36
+            except NoResultFound:
37
                 return {'status': 'error',
37
                 return {'status': 'error',
38
-                        'error': 'bad content id',}
38
+                        'error': 'bad content id', }
39
             # INFO - G.M - 2017-11-17
39
             # INFO - G.M - 2017-11-17
40
             # When content_id is a sub-elem of a main content like Comment,
40
             # When content_id is a sub-elem of a main content like Comment,
41
             # Attach the thread to the main content.
41
             # Attach the thread to the main content.
43
                 thread = thread.parent
43
                 thread = thread.parent
44
             if thread.type == ContentType.Folder:
44
             if thread.type == ContentType.Folder:
45
                 return {'status': 'error',
45
                 return {'status': 'error',
46
-                        'error': 'comment for folder not allowed',}
46
+                        'error': 'comment for folder not allowed', }
47
             api.create_comment(thread.workspace, thread,
47
             api.create_comment(thread.workspace, thread,
48
                                json['payload']['content'], True)
48
                                json['payload']['content'], True)
49
-            return {'status': 'ok',}
49
+            return {'status': 'ok', }
50
         else:
50
         else:
51
             return {'status': 'error',
51
             return {'status': 'error',
52
-                    'error': 'invalid token',}
52
+                    'error': 'invalid token', }