diff src/server/blog.py @ 481:bbdc5357dc00

browser and server sides: refactor HTTP request result values + handle "NoReply" error
author souliane <souliane@mailoo.org>
date Sun, 15 Jun 2014 17:52:08 +0200
parents 3ef6ce200c27
children 0bbbef1d53a8
line wrap: on
line diff
--- a/src/server/blog.py	Sat Jun 14 19:20:27 2014 +0200
+++ b/src/server/blog.py	Sun Jun 15 17:52:08 2014 +0200
@@ -59,7 +59,7 @@
             prof_requested = request.postpath[0]
             #TODO: char check: only use alphanumerical chars + some extra(_,-,...) here
             prof_found = self.host.bridge.getProfileName(prof_requested)
-            if not prof_found or prof_found == 'libervia':
+            if not prof_found or prof_found == C.SERVICE_PROFILE:
                 return MicroBlog.ERROR_TEMPLATE % {'root': '../' * len(request.postpath),
                                                     'message': "Invalid nickname"}
             else:
@@ -74,7 +74,7 @@
                     if len(request.postpath) > 1:
                         if request.postpath[1] == 'atom.xml':  # return the atom feed
                             d2.addCallbacks(self.render_atom_feed, self.render_error_blog, [request], None, [request, prof_found], None)
-                            self.host.bridge.getLastGroupBlogsAtom(pub_jid.userhost(), max_items, 'libervia', d2.callback, d2.errback)
+                            self.host.bridge.getLastGroupBlogsAtom(pub_jid.userhost(), max_items, C.SERVICE_PROFILE, d2.callback, d2.errback)
                             return
                         try:  # check if the given path is a valid UUID
                             uuid.UUID(request.postpath[1])
@@ -83,9 +83,9 @@
                             pass
                     d2.addCallbacks(self.render_html_blog, self.render_error_blog, [request, prof_found], None, [request, prof_found], None)
                     if item_id:  # display one message and its comments
-                        self.host.bridge.getGroupBlogsWithComments(pub_jid.userhost(), [item_id], 'libervia', d2.callback, d2.errback)
+                        self.host.bridge.getGroupBlogsWithComments(pub_jid.userhost(), [item_id], C.SERVICE_PROFILE, d2.callback, d2.errback)
                     else:  # display the last messages without comment
-                        self.host.bridge.getLastGroupBlogs(pub_jid.userhost(), max_items, 'libervia', d2.callback, d2.errback)
+                        self.host.bridge.getLastGroupBlogs(pub_jid.userhost(), max_items, C.SERVICE_PROFILE, d2.callback, d2.errback)
 
                 d1 = defer.Deferred()
                 JID(self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', C.SERVER_SECURITY_LIMIT, prof_found, callback=d1.callback, errback=d1.errback))