If I understand your question correctly, in order to achieve this, you are going to need to to override getServiceRequest
on the Gateway class that you are using:
from pyamf.remoting.gateway.django import DjangoGateway
from pyamf.remoting.gateway import UnknownServiceError
class MyGateway(DjangoGateway):
def __init__(self, router_func, **kwargs):
self.router = router_func
DjangoGateway.__init__(self, **kwargs)
def getServiceRequest(self, request, target):
try:
return DjangoGateway.getServiceRequest(self, request, target)
except UnknownServiceError, e:
pass
# cached service was not found, try to discover it
try:
service_func = self.router(target)
except:
# perhaps some logging here
service_func = None
if not service_func:
# couldn't find a service matching `target`, crap out appropriately
raise e
self.addService(service_func, target)
return DjangoGateway.getServiceRequest(self, request, target)
self.router
is a function that you supply to the constructor of the gateway. It takes the string target of the AMF remoting request and returns a matching function. If it returns None
or raises an exception, an unknown service response will be returned to the requestor.
Hopefully this goes some way to laying the groundwork for what you require.