From: <bov...@us...> - 2007-07-06 18:35:44
|
Revision: 1401 http://svn.sourceforge.net/pywebsvcs/?rev=1401&view=rev Author: boverhof Date: 2007-07-06 11:35:46 -0700 (Fri, 06 Jul 2007) Log Message: ----------- M RELEASE -- python is now in svn not cvs M ZSI/twisted/wsgi.py -- couple main functions for testing M ZSI/TC.py FIX [ 1749290 ] TC.QName default namespace error Modified Paths: -------------- trunk/zsi/RELEASE trunk/zsi/ZSI/TC.py trunk/zsi/ZSI/twisted/wsgi.py Modified: trunk/zsi/RELEASE =================================================================== --- trunk/zsi/RELEASE 2007-06-29 22:50:57 UTC (rev 1400) +++ trunk/zsi/RELEASE 2007-07-06 18:35:46 UTC (rev 1401) @@ -123,12 +123,11 @@ - Get the LaTeX version of the documentation package and unpack it. Create the symlink to .../Python-Doc-VERSION/tools/mkhowto. -- Get them from CVS. If you have an existing Python checkout, you can +- Get them from SVN. If you have an existing Python checkout, you can symlink to the .../Doc/tools/mkhowto script in that. If not, then you only need to check out the Doc/ tree:: - cvs -d :pserver:ano...@cv...:/cvsroot/python \ - checkout -d someplace python/dist/src/Doc + svn co http://svn.python.org/projects/python/trunk/Doc python-Do The symlink can then be made to .../someplace/tools/mkhowto. Modified: trunk/zsi/ZSI/TC.py =================================================================== --- trunk/zsi/ZSI/TC.py 2007-06-29 22:50:57 UTC (rev 1400) +++ trunk/zsi/ZSI/TC.py 2007-07-06 18:35:46 UTC (rev 1401) @@ -782,6 +782,7 @@ ''' prefix,localName = SplitQName(text) nsdict = ps.GetElementNSdict(elt) + prefix = prefix or '' try: namespaceURI = nsdict[prefix] except KeyError, ex: Modified: trunk/zsi/ZSI/twisted/wsgi.py =================================================================== --- trunk/zsi/ZSI/twisted/wsgi.py 2007-06-29 22:50:57 UTC (rev 1400) +++ trunk/zsi/ZSI/twisted/wsgi.py 2007-07-06 18:35:46 UTC (rev 1401) @@ -15,7 +15,46 @@ from ZSI.twisted.reverse import DataHandler, ReverseHandlerChain,\ HandlerChainInterface +""" +WSGI Module +unstable + +EXAMPLE APPLICATION: +# +from EchoServer_client import * +from ZSI.twisted.wsgi import SOAPApplication, soapmethod, SOAPHandlerChainFactory + +class EchoService(SOAPApplication): + factory = SOAPHandlerChainFactory + wsdl_content = dict(name='', targetNamespace='', imports=(), portType='') + + @soapmethod(EchoRequest.typecode, EchoResponse.typecode, operation='Echo', soapaction='Echo') + def soap_Echo(self, request, response, **kw): + response.EchoResult = request.EchoIn + return request,response + + +def main(): + from wsgiref.simple_server import make_server, demo_app + application = WSGIApplication() + httpd = make_server('', 8000, application) + application['echo'] = EchoService() + httpd.serve_forever() + +def main_twisted(): + from ZSI.twisted.wsgi import test, WSGIApplication + app = WSGIApplication() + app['echo'] = EchoService() + test(app) + +if __name__ == '__main__': + main_twisted() + +""" + + + def soapmethod(requesttypecode, responsetypecode, soapaction='', operation=None, **kw): """@soapmethod @@ -116,6 +155,29 @@ """ start_response("404 ERROR", [('Content-Type','text/plain')]) return ['Move along people, there is nothing to see to hear'] + + def putChild(self, path, resource): + """ + """ + path = path.split('/') + lp = len(path) + if lp == 0: + raise RuntimeError, 'bad path "%s"' %path + + if lp == 1: + self[path[0]] = resource + + for i in range(len(path)): + if not path[i]: continue + break + + next = self.get(path[i], None) + if next is None: + next = self[path[i]] = WSGIApplication() + + next.putChild('/'.join(path[-1:]), resource) + + class SOAPApplication(WSGIApplication): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |