Hi,

I'm writing a service that exposes a bunch of methods over AMP.

These methods are easily logically grouped into separate modules (i.e. 
message-related, picture-related…). So, I'd like to define the behavior for 
those methods in those modules.

However, the amp.Command.responder decorator only works inside the class 
definition of an AMP subclass.  
(http://twistedmatrix.com/documents/current/api/twisted.protocols.amp.Command.html#responder).

Does that mean I should have multiple AMP subclasses? How do I get all of them 
to listen on the same port? Is this what the mysterious "routes" feature I've 
been hearing about does?

Right now I'm doing it like this, which works but isn't very pretty or nice:

user.py:
-----
class Register(amp.Command):
    arguments = […]
    response = […]
    errors = […]


def register(self, …):
    # do actual registering behavior here
-----

api.py:
-----
from project import auth

class API(amp.AMP):
    register = auth.Register.responder(auth.register)
-----


cheers
lvh




_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to