Skip to content

Commit 16ada4c

Browse files
author
Jamie Kirkpatrick
committed
Remove dependency on cherrypy (now uses the reference WSGI server in Python 2.5 so that version is the lowest usable distrubution now).
1 parent fc2abe4 commit 16ada4c

11 files changed

+150
-155
lines changed

examples/async.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from soaplib.serializers.binary import Attachment
55
from soaplib.util import get_callback_info
66

7+
from wsgiref.simple_server import make_server
78
from threading import Thread
89
from tempfile import mkstemp
910
import time
@@ -36,7 +37,5 @@ def woke_up(self,message):
3637
pass
3738

3839
if __name__=='__main__':
39-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
40-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
41-
server = CherryPyWSGIServer(('localhost',7789),SleepingService())
42-
server.start()
40+
server = make_server('localhost', 7789, SleepingService())
41+
server.serve_forever()

examples/binary.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from soaplib.serializers.primitive import String, Integer, Array
44
from soaplib.serializers.binary import Attachment
55

6+
from wsgiref.simple_server import make_server
67
from tempfile import mkstemp
78
import os
89

@@ -46,7 +47,5 @@ def make_client():
4647
return client
4748

4849
if __name__=='__main__':
49-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
50-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
51-
server = CherryPyWSGIServer(('localhost',7889),DocumentArchiver())
52-
server.start()
50+
server = make_server('localhost', 7889, DocumentArchiver())
51+
server.serve_forever()

examples/classserializer.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from soaplib.serializers.primitive import String, Integer, Array
44
from soaplib.serializers.clazz import ClassSerializer
55

6+
from wsgiref.simple_server import make_server
7+
68
'''
79
This example shows how to define and use complex structures
810
in soaplib. This example uses an extremely simple in-memory
@@ -59,7 +61,5 @@ def list_users(self):
5961
return [v for k,v in user_database.items()]
6062

6163
if __name__=='__main__':
62-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
63-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
64-
server = CherryPyWSGIServer(('localhost',7789),UserManager())
65-
server.start()
64+
server = make_server('localhost', 7789, UserManager())
65+
server.serve_forever()

examples/helloworld.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from soaplib.service import soapmethod
33
from soaplib.serializers.primitive import String, Integer, Array
44

5+
from wsgiref.simple_server import make_server
6+
57
'''
68
This is a simple HelloWorld example to show the basics of writing
79
a webservice using soaplib, starting a server, and creating a service
@@ -30,7 +32,5 @@ def make_client():
3032
return client
3133

3234
if __name__=='__main__':
33-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
34-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
35-
server = CherryPyWSGIServer(('localhost',7889),HelloWorldService())
36-
server.start()
35+
server = make_server('localhost', 7889, HelloWorldService())
36+
server.serve_forever()

examples/helloworld_attach.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from soaplib.serializers.primitive import String, Integer, Array
66
from soaplib.serializers.binary import Attachment
77

8+
from wsgiref.simple_server import make_server
9+
810
class HelloWorldService(SimpleWSGISoapApp):
911

1012
@soapmethod(Attachment,Integer,_returns=Array(String), _mtom=True)
@@ -15,8 +17,5 @@ def say_hello(self,name,times):
1517
return results
1618

1719
if __name__=='__main__':
18-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
19-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
20-
# this example uses CherryPy2.2, use cherrypy.wsgiserver.CherryPyWSGIServer for CherryPy 3.0
21-
server = CherryPyWSGIServer(('localhost',7789),HelloWorldService())
22-
server.start()
20+
server = make_server('localhost', 7789, HelloWorldService())
21+
server.serve_forever()

examples/hooks.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from soaplib.wsgi_soap import SimpleWSGISoapApp
22
from soaplib.service import soapmethod
33
from soaplib.serializers.primitive import String, Integer, Array
4-
54
from soaplib.wsgi_soap import request
5+
66
from time import time
7+
from wsgiref.simple_server import make_server
8+
79

810
'''
911
This example is an enhanced version of the HelloWorld example that
@@ -62,7 +64,5 @@ def make_client():
6264
return client
6365

6466
if __name__=='__main__':
65-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
66-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
67-
server = CherryPyWSGIServer(('localhost',7889),HelloWorldService())
68-
server.start()
67+
server = make_server('localhost', 7889, HelloWorldService())
68+
server.serve_forever()

examples/override.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from soaplib.service import soapmethod
33
from soaplib.serializers.primitive import String, Integer, Array
44

5+
from wsgiref.simple_server import make_server
6+
57
'''
68
This example shows how to override the variable names for fun and profit.
79
This is very useful for situations that require the use of variable names
@@ -18,7 +20,5 @@ def sendEmail(self,_to,_from,message):
1820
return 'sent!'
1921

2022
if __name__=='__main__':
21-
try:from cherrypy.wsgiserver import CherryPyWSGIServer
22-
except:from cherrypy._cpwsgiserver import CherryPyWSGIServer
23-
server = CherryPyWSGIServer(('localhost',7989),EmailManager())
24-
server.start()
23+
server = make_server('localhost', 7989,EmailManager())
24+
server.serve_forever()

setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env python
22

33
from setuptools import setup, find_packages
4+
import sys
5+
6+
if sys.hexversion < 0x2050000
7+
raise RuntimeError("Python 2.5 or higher required)
48

59

610
VERSION = '0.7.2'
@@ -34,7 +38,7 @@
3438
license='LGPL',
3539
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
3640
zip_safe=False,
37-
install_requires=['pytz', 'cherrypy', 'lxml'],
41+
install_requires=['pytz', 'lxml'],
3842
test_suite='tests.test_suite',
3943
entry_points="""
4044
""",

0 commit comments

Comments
 (0)