8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
9 #See the GNU General Public License for more details. |
9 #See the GNU General Public License for more details. |
10 |
10 |
11 #You should have received a copy of the GNU General Public License |
11 #You should have received a copy of the GNU General Public License |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
13 from twisted.web import soap, xmlrpc, resource, server |
13 from twisted.web import soap, xmlrpc |
14 from twisted.internet import reactor |
|
15 |
|
16 import logging |
|
17 |
|
18 |
14 |
19 from ..controller.viewinterface import Interface |
15 from ..controller.viewinterface import Interface |
20 |
16 |
21 from ..error import InterfaceException, ValidateException |
17 from ..error import InterfaceException, ValidateException |
22 |
18 |
23 class TwistedInterface(Interface): |
19 class TwistedInterface(Interface): |
24 |
|
25 def __init__(self): |
20 def __init__(self): |
26 Interface.__init__(self) |
21 Interface.__init__(self) |
27 |
|
28 |
22 |
29 def listMethods(self): |
23 def listMethods(self): |
30 """Since we override lookupProcedure, its suggested to override |
24 """Since we override lookupProcedure, its suggested to override |
31 listProcedures too. |
25 listProcedures too. |
32 """ |
26 """ |
83 return function, getattr(function, "useKeywords", False) |
77 return function, getattr(function, "useKeywords", False) |
84 return None |
78 return None |
85 else: |
79 else: |
86 return None |
80 return None |
87 |
81 |
88 def getResource(): |
82 def appendResource(root): |
89 root = resource.Resource() |
|
90 root.putChild('RPC2', XMLRPCInterface()) |
83 root.putChild('RPC2', XMLRPCInterface()) |
91 root.putChild('SOAP', SOAPInterface()) |
84 root.putChild('SOAP', SOAPInterface()) |
92 return root |
85 return root |
93 |
86 |
94 def main(): |
87 if __name__ == '__main__': |
95 reactor.listenTCP(7080, server.Site(getResource())) |
88 from twisted.web import resource, server |
|
89 from twisted.internet import reactor |
|
90 |
|
91 root = resource.Resource() |
|
92 root = appendResource(root) |
|
93 reactor.listenTCP(7080, server.Site(root)) |
96 reactor.run() |
94 reactor.run() |
97 |
|
98 if __name__ == '__main__': |
|
99 main() |
|