iro/iro.py
branchdevel
changeset 296 a73bbc1d8b4b
parent 294 0e75bd39767d
child 297 93686b0c028b
equal deleted inserted replaced
295:dc3cc61c7f6f 296:a73bbc1d8b4b
    26 from twisted.python import log
    26 from twisted.python import log
    27 
    27 
    28 from sqlalchemy import create_engine, pool
    28 from sqlalchemy import create_engine, pool
    29 
    29 
    30 import config, install
    30 import config, install
    31 from .view import xmlrpc
    31 from .view import xmlrpc, jsonrpc
    32 from .model import setEngine, setPool
    32 from .model import setEngine, setPool
    33 from .controller.pool import startPool, dbPool
    33 from .controller.pool import startPool, dbPool
    34 
    34 
    35 class IroService(Service):
    35 class IroService(Service):
    36     def startService(self):
    36     def startService(self):
    65         log.msg("Offer(%s) is orphand (no route using this offer)."%o)
    65         log.msg("Offer(%s) is orphand (no route using this offer)."%o)
    66     if ao["added"]:
    66     if ao["added"]:
    67         raise Exception("offerlist is not up-to-date.\nPlease run iro-install --update")
    67         raise Exception("offerlist is not up-to-date.\nPlease run iro-install --update")
    68 
    68 
    69     root = resource.Resource()
    69     root = resource.Resource()
    70     root = xmlrpc.appendResource(root)
    70     xmlrpc.appendResource(root)
       
    71     jsonrpc.appendResource(root)
    71     
    72     
    72     v2 = resource.Resource()
    73     v2 = resource.Resource()
    73     v2 = xmlrpc.appendResource(root)
    74     xmlrpc.appendResource(v2)
       
    75     jsonrpc.appendResource(v2)
    74     root.putChild('1.0a', v2)
    76     root.putChild('1.0a', v2)
    75 
    77 
    76     internet.TCPServer(config.main.port, server.Site(root)).setServiceParent(top_service)
    78     internet.TCPServer(config.main.port, server.Site(root)).setServiceParent(top_service)
    77     IroService().setServiceParent(top_service)
    79     IroService().setServiceParent(top_service)
    78     return top_service
    80     return top_service