/usr/share/doc/python-soaplib/examples/override.py is in python-soaplib 0.8.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import String, Integer, Array
'''
This example shows how to override the variable names for fun and profit.
This is very useful for situations that require the use of variable names
that are python keywords like, from, to, import, return, etc.
'''
class EmailManager(SimpleWSGISoapApp):
@soapmethod(String,String,String,
_inVariableNames={'_to':'to','_from':'from','_message':'message'},
_outVariableName='return')
def sendEmail(self,_to,_from,message):
# do email sending here
return 'sent!'
if __name__=='__main__':
try:
from wsgiref.simple_server import make_server
server = make_server('localhost', 7789, EmailManager())
server.serve_forever()
except ImportError:
print "Error: example server code requires Python >= 2.5"
|