diff libervia.tac @ 10:c28a4840e1a8

server: microblog resource
author Goffi <goffi@goffi.org>
date Fri, 25 Mar 2011 00:32:58 +0100
parents 154d4caa57f4
children 331c093e4eb3
line wrap: on
line diff
--- a/libervia.tac	Fri Mar 25 00:31:27 2011 +0100
+++ b/libervia.tac	Fri Mar 25 00:32:58 2011 +0100
@@ -28,10 +28,13 @@
 from twisted.web import error as weberror
 from twisted.web.static import File
 from twisted.web.resource import Resource
+from twisted.words.protocols.jabber.jid import JID
 from txjsonrpc.web import jsonrpc
 from txjsonrpc import jsonrpclib
 from sat_frontends.bridge.DBus import DBusBridgeFrontend,BridgeExceptionNoService
 
+from server_side.blog import MicroBlog
+
 TIMEOUT = 120 #Session's time out, after that the user will be disconnected
 
 
@@ -237,17 +240,14 @@
         self.request = request
         return jsonrpc.JSONRPC.render(self, request)
 
+
 class Libervia(service.Service):
    
     def __init__(self):
         root = File("output/") 
         self.signal_handler = SignalHandler(self)
-        root.putChild('json_signal_api', self.signal_handler)
         _register = Register(self)
         self.signal_handler.plugRegister(_register)
-        root.putChild('json_api', MethodHandler(self))
-        root.putChild('register_api', _register)
-        self.site = server.Site(root)
         self.sessions = {} #key = session value = user
         ## bridge ##
         try:
@@ -260,6 +260,12 @@
         self.bridge.register("connectionError", self.signal_handler.connectionError)
         for signal_name in ['presenceUpdate', 'personalEvent']:
             self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
+        root.putChild('json_signal_api', self.signal_handler)
+        root.putChild('json_api', MethodHandler(self))
+        root.putChild('register_api', _register)
+        root.putChild('blog', MicroBlog(self))
+        root.putChild('css', File("server_css/"))
+        self.site = server.Site(root)
 
     def startService(self):
         reactor.listenTCP(8080, self.site)