Mercurial > libervia-web
comparison src/pages/common/blog/page_meta.py @ 933:e4c13a995e0b
pages (common/blog): data post (i.e. new comments) is now handled
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 17 Apr 2017 20:44:10 +0200 |
parents | af6a62e21053 |
children | 1375b96f4309 |
comparison
equal
deleted
inserted
replaced
932:af6a62e21053 | 933:e4c13a995e0b |
---|---|
93 if show_comments: | 93 if show_comments: |
94 yield appendComments(self, items, profile) | 94 yield appendComments(self, items, profile) |
95 | 95 |
96 template_data = request.template_data | 96 template_data = request.template_data |
97 template_data[u'items'] = items | 97 template_data[u'items'] = items |
98 template_data[u'allow_commenting'] = u'simple' | |
99 | |
100 | |
101 @defer.inlineCallbacks | |
102 def on_data_post(self, request): | |
103 profile = self.getProfile(request) | |
104 if profile is None: | |
105 self.pageError(request, C.HTTP_UNAUTHORIZED) | |
106 service, node, body = self.getPostedData(request, (u'service', u'node', u'body')) | |
107 if not body: | |
108 self.pageError(request, C.HTTP_BAD_REQUEST) | |
109 comment_data = {u"content": body} | |
110 try: | |
111 yield self.host.bridge.mbSend(service, node, comment_data, profile) | |
112 except Exception as e: | |
113 if u"forbidden" in unicode(e): | |
114 self.pageError(request, 401) | |
115 else: | |
116 raise e |