The downside for this is that it does not dispatch to multiple
services and does not automatically support the registry yet.
If you are using Python 2.7 you probably don't need the
multi-mapping since you can map to each ProtoRPC handler via app.yaml.
There will be better support for these kinds of handlers in the future.
SERVICE_ROUTES = [('/api/foo', FooService),('/api/bar', BarService)]application = webapp.WSGIApplication(service_handlers.service_mapping(SERVICE_ROUTES))
I believe that they are as long as your service handler instance is
thread safe. Recall that a new instance of a service is created upon
each request. All the state of a WSGI handler is read-only once
properly configured.
I must admit it has not been tested under 2.7 very extensively, and
it is still very much experimental. However, it should be ok.
You can also put all the handlers in one file:
foo_services.py:
bar_service = ...
baz_service = ...
app.yaml:
handlers:
- url /bar/.*
script: foo_services.bar_service
- url /baz/.*
script: foo_services.baz_service
> Ah, well, naturally, my service handler instance code must be thread safe, I
> was just asking about the internals of ProtoRPC.
Understood. ProtoRPC has always needed to run in non-appengine
environments, so we have paid attention to thread-safety.
> Rafe, the "experimental" disclaimers sounds like "consult your lawyer" type
> of disclaimer. I know it's "experimental", by risk using it production I'm
> trying to "encouage" you to move it the next level, because I think ProtoRPC
> is very valuable.
> Thanks
>
I apologize if it sounds legalistic. I assure you I am looking at
it form a developer point of view. I mention it because I really am
concerned about its shortcomings. It's worth emphasizing how much I
appreciate that you are using it in this state, and how much I want to
help make sure it works for you.