Prologue: I'm going to violate the cardinal rule of question asking and 
not post code, simply because I'm not to the point of having a test 
case yet. That said:

We have had running, for a few months now, this stack:

CherryPy -> modpython_gateway.py -> mod_python

As I investigated, I discovered (I didn't set it up) that 
modpython_gateway.py is a full WSGI layer that wraps CherryPy.  So, 
between some PYTHON_PATH problems we've been having and in interest of 
moving off of an unmaintained project, I set out to investigate 
mod_wsgi (thanks Graham for the pointer...that was me on the mod_python 
list).

So, I've got it somewhat working.  Our custom CherryPy bootup script has 
an application object (retrieved from cherrypy.tree.mount) that is 
found, and anything exposed as regular HTTP works fine.  I say regular 
HTTP because we have custom logic to expose some methods that pertain 
to AMF calls.

On the original stack, all worked fine.  However, under mod_wsgi methods 
exposed via our custom expose_as_amf() logic return a 404.  And it's 
not Apache, I get the 404 from CherryPy.

The only major thing that might have changed is that our source path is 
no longer first in sys.path.  mod_python allows you to do this:

PythonPath "['/home/wsbuild/wordstream/server/wordstream/src']+sys.path"

Whereas mod_wsgi only has a directive for appending to sys.path.

Other than that, is there any code I need to look for that would change 
the behavior between the original stack and the pure mod_wsgi stack?

Here is our expose as http methods and expose as amf methods if it helps 
any. (Mind the wrap)

    @staticmethod
    def expose_as_http(func=None, alias=None):
        def http_deco(f):
            expose_func = cherrypy.expose(func, alias)
            f = expose_func(f)
            cleanup_func =
cherrypy.tools.post_request_connection_cleanup_tool()
            f = cleanup_func(f)
            return f
        return http_deco

    @staticmethod
    def expose_as_amf(uri, name=None, authenticator=None):
        '''Decorator to expose a function as an AMF service

        @param uri: AMF service endpoint URL
        @type uri: str
        @param name: AMF service name (if None, uses function name)
        @type name: str
        @param authenticator: Custom Authenticator (if None, uses
self.authenticate)
        @type authenticator: function
        '''
        parent_vars = sys._getframe(1).f_locals

        def null_deco(f):
            if name:
                method_name = name
            else:
                method_name = f.__name__
            parent_vars.setdefault('amf_methods', []).append((uri,
method_name, f, authenticator))
            return f
        return null_deco

Thanks for any pointers!

j
-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to