[mod_python] ZSI and mod_python

Robert Synnott rsynnott at gmail.com
Sun Aug 13 14:37:25 EDT 2006

On 8/11/06, justind <justind at ussonet.net> wrote:
> I posted on the ZSI board to, thought I better here just to cover all
> the bases.
> Has anyone used ZSI with mod_python? If so, there is an example of how
> to use ZSI with mod_python in ZSI's documentation.
> This feels  like a "I'm being stupid and forgetting/overlooking
> something obvious" type of problem.
>  From the example below, there is a module called MyHandler that has 3
> functions (hello,echo and average). You expose these functions through
> the dispatch.AsHandler() function in the mod_python code.
> Suppose that I only wanted to expose the hello and echo functions, but
> not the average function. I want to keep the average function in the
> module because some other function(s) I will make later will use it.
> (Section 2.1.3).
> The following is a complete example of a simple handler. The soap
> operations are implemented in the MyHandler module:
> def hello():
>     return "Hello, world"
> def echo(*args):
>     return args
> def average(*args):
>     sum = 0
>     for i in args: sum += i
>     return sum / len(args)
> Dispatching from within mod_python is achieved by passing the
> aforementined MyHandler module to |dispatch.AsHandler()|. The following
> code exposes the operations defined in MyHandler via SOAP:
> from ZSI import dispatch
> from mod_python import apache
> import MyHandler
> mod = __import__('encodings.utf_8', globals(), locals(), '*')
> mod = __import__('encodings.utf_16_be', globals(), locals(), '*')
> def handler(req):
>     dispatch.AsHandler(modules=(MyHandler,), request=req)
>     return apache.OK
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

I don't THINK the underscore trick works for mod_python. You really
have two options; you could put the offending functions in a separate
module, or you could write your own handler (if you want to do the
whole wsdl2py, wsdl2dispatch thing you'll have to do that anyway,

More information about the Mod_python mailing list