Hi!

I started on a networking layer in branch

http://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.base/branches/mrtopf-networklayer

It can be found in network/ and tests can be found in network/tests.

It defines an interface IRESTClient with methods like GET(), POST() and so on (at least that's the plan, so far we have GET and POST).

There are two implementations of that interface now which can be obtained as utilities. See

http://svn.secondlife.com/trac/linden/browser/projects/2008/pyogp/pyogp.lib.base/branches/mrtopf-networklayer/pyogp/lib/base/network/tests/basics.txt

on how to use it. Should be straightforward.

The one implementation in network/stdlib_client.py uses urllib2 and probably later on httplib (for the other methods).

The other one is for testing and does no network traffic at all. It can be found in network/mockup_client.py and is already used by the doctests. This means that you don't have to start bin/testserver before tests anymore.

What it does is to use webob to construct a request and passes it directly to my WSGI application which the testserver is made up from.
The actual WSGI server does not need to run. With

request.get_response(wsgi_app)

you will get a Response object directly which you can process further. This is what's done in the mockup client.


The tests override the utility for IRESTClient as you can see in
setUp() in

http://svn.secondlife.com/trac/linden/browser/projects/2008/pyogp/pyogp.lib.base/branches/mrtopf-networklayer/pyogp/lib/base/network/tests/testDocTests.py

This is not clean though. We better use some ZCML overrides configuration or grokcore.component for overriding this propertly so that we aren't dependant on login order.

(AgentDomain in this case is the WSGI application)

So running

bin/test testDocTests

in that branch should run all doctests without the need to running a separate testserver. Hope it works for you, too :-)

(to switch to that branch you can do a

svn switch http://svn.secondlife.com/svn/linden/projects/2008/pyogp/pyogp.lib.base/branches/mrtopf-networklayer

inside the src/pyogp.lib.base directory).


-- Christian






--
Christian Scholz                         video blog: http://comlounge.tv
COM.lounge                                   blog: http://mrtopf.de/blog
Luetticher Strasse 10                                    Skype: HerrTopf
52064 Aachen                              Homepage: http://comlounge.net
Tel: +49 241 400 730 0                           E-Mail [EMAIL PROTECTED]
Fax: +49 241 979 00 850                               IRC: MrTopf, Tao_T

neue Show: TOPFtäglich (http://mrtopf.de/blog/category/topf-taglich/)

_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/pyogp

Reply via email to