Mercurial > libervia-web
comparison libervia_server/blog.py @ 433:bbdbee25123a
import constants.Const as C (according to the coding rules)
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 01 May 2014 11:29:09 +0200 |
parents | 35a43d0dc032 |
children | 73f767a9ac2f |
comparison
equal
deleted
inserted
replaced
432:8ecc5a7062e4 | 433:bbdbee25123a |
---|---|
23 from twisted.internet import defer | 23 from twisted.internet import defer |
24 from twisted.web import server | 24 from twisted.web import server |
25 from twisted.web.resource import Resource | 25 from twisted.web.resource import Resource |
26 from twisted.words.protocols.jabber.jid import JID | 26 from twisted.words.protocols.jabber.jid import JID |
27 from datetime import datetime | 27 from datetime import datetime |
28 from constants import Const | 28 from constants import Const as C |
29 import uuid | 29 import uuid |
30 import re | 30 import re |
31 | 31 |
32 | 32 |
33 class MicroBlog(Resource): | 33 class MicroBlog(Resource): |
82 self.host.bridge.getGroupBlogsWithComments(pub_jid.userhost(), [item_id], 'libervia', d2.callback, d2.errback) | 82 self.host.bridge.getGroupBlogsWithComments(pub_jid.userhost(), [item_id], 'libervia', d2.callback, d2.errback) |
83 else: # display the last messages without comment | 83 else: # display the last messages without comment |
84 self.host.bridge.getLastGroupBlogs(pub_jid.userhost(), 10, 'libervia', d2.callback, d2.errback) | 84 self.host.bridge.getLastGroupBlogs(pub_jid.userhost(), 10, 'libervia', d2.callback, d2.errback) |
85 | 85 |
86 d1 = defer.Deferred() | 86 d1 = defer.Deferred() |
87 JID(self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', Const.SERVER_SECURITY_LIMIT, prof_found, callback=d1.callback, errback=d1.errback)) | 87 JID(self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', C.SERVER_SECURITY_LIMIT, prof_found, callback=d1.callback, errback=d1.errback)) |
88 d1.addCallbacks(got_jid) | 88 d1.addCallbacks(got_jid) |
89 | 89 |
90 return server.NOT_DONE_YET | 90 return server.NOT_DONE_YET |
91 | 91 |
92 def render_html_blog(self, mblog_data, request, profile): | 92 def render_html_blog(self, mblog_data, request, profile): |
101 style = {'banner': banner} | 101 style = {'banner': banner} |
102 else: | 102 else: |
103 style = {} | 103 style = {} |
104 self.__render_html_blog(mblog_data, style, request, profile) | 104 self.__render_html_blog(mblog_data, style, request, profile) |
105 eb = lambda failure: self.render_error_blog(failure, request, profile) | 105 eb = lambda failure: self.render_error_blog(failure, request, profile) |
106 self.host.bridge.asyncGetParamA('Blog banner', 'Misc', 'value', Const.SERVER_SECURITY_LIMIT, profile, callback=check_banner, errback=eb) | 106 self.host.bridge.asyncGetParamA('Blog banner', 'Misc', 'value', C.SERVER_SECURITY_LIMIT, profile, callback=check_banner, errback=eb) |
107 | 107 |
108 def __render_html_blog(self, mblog_data, style, request, profile): | 108 def __render_html_blog(self, mblog_data, style, request, profile): |
109 """Actually render the static blog. If mblog_data is a list of dict, we are missing | 109 """Actually render the static blog. If mblog_data is a list of dict, we are missing |
110 the comments items so we just display the main items. If mblog_data is a list of couple, | 110 the comments items so we just display the main items. If mblog_data is a list of couple, |
111 each couple is associating a main item data with the list of its comments, so we render all. | 111 each couple is associating a main item data with the list of its comments, so we render all. |