Mercurial > libervia-web
comparison server_side/blog.py @ 149:f78761e1be8e
server side: fixed public microblog
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 10 Dec 2012 00:35:37 +0100 |
parents | ddfcc4cb6cee |
children | 9763dec220ed |
comparison
equal
deleted
inserted
replaced
148:8635bc9db9bf | 149:f78761e1be8e |
---|---|
54 #TODO: char check: only use alphanumerical chars + some extra(_,-,...) here | 54 #TODO: char check: only use alphanumerical chars + some extra(_,-,...) here |
55 prof_found = self.host.bridge.getProfileName(prof_requested) | 55 prof_found = self.host.bridge.getProfileName(prof_requested) |
56 if not prof_found or prof_found=='libervia': | 56 if not prof_found or prof_found=='libervia': |
57 return MicroBlog.ERROR_TEMPLATE % "Invalid nickname" | 57 return MicroBlog.ERROR_TEMPLATE % "Invalid nickname" |
58 else: | 58 else: |
59 pub_jid=JID(self.host.bridge.getParamA('JabberID','Connection','value',prof_found)) | 59 def got_jid(pub_jid_s): |
60 d = defer.Deferred() | 60 pub_jid = JID(pub_jid_s) |
61 d.addCallbacks(self.render_html_blog, self.render_error_blog, [request, prof_found], None, [request, prof_found], None) | 61 d2 = defer.Deferred() |
62 self.host.bridge.getLastMicroblogs(pub_jid.userhost(), 10, 'libervia', d.callback, d.errback) | 62 d2.addCallbacks(self.render_html_blog, self.render_error_blog, [request, prof_found], None, [request, prof_found], None) |
63 self.host.bridge.getLastGroupBlogs(pub_jid.userhost(), 10, 'libervia', d2.callback, d2.errback) | |
64 | |
65 d1 = defer.Deferred() | |
66 JID(self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', prof_found, callback=d1.callback, errback=d1.errback)) | |
67 d1.addCallbacks(got_jid) | |
63 | 68 |
64 return server.NOT_DONE_YET | 69 return server.NOT_DONE_YET |
65 | 70 |
66 def render_html_blog(self, mblog_data, request, profile): | 71 def render_html_blog(self, mblog_data, request, profile): |
67 user = sanitizeHtml(profile).encode('utf-8') | 72 user = sanitizeHtml(profile).encode('utf-8') |