| Home | Trees | Indices | Help |
|
|---|
|
|
The @route decorator is attached to state handlers to configure them in the Router so they handle messages for them. The way this works is, rather than just routing working on only messages being sent to a state handler, it also uses the state of the sender. It's like having routing in a web application use both the URL and an internal state setting to determine which method to run.
However, if you'd rather than this state handler process all messages matching the @route then tag it @stateless. This will run the handler no matter what and not change the user's state.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
Sets up the pattern used for the Router configuration. The format
parameter is a simple pattern of words, captures, and anything you
want to ignore. The captures parameter is a mapping of the words in
the format to regex that get put into the format. When the pattern is
matched, the captures are handed to your state handler as keyword
arguments.
For example, if you have:
@route("(list_name)-(action)@(host)",
list_name='[a-z]+',
action='[a-z]+', host='test\.com')
def STATE(message, list_name=None, action=None, host=None):
....
Then this will be translated so that list_name is replaced with [a-z]+,
action with [a-z]+, and host with 'test.com' to produce a regex with the
right format and named captures to that your state handler is called
with the proper keyword parameters.
You should also use the Router.defaults() to set default things like the
host so that you are not putting it into your code.
|
Returns either a decorator that does a stateless routing or a normal routing. |
This is NOT SUPPORTED. It is here just so that if you try to apply this decorator to a class's method it will barf on you. |
Does the grunt work of convertion format+captures into the regex. |
Sets up an accounting map attached to the func for routing decorators. |
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Jul 7 07:32:53 2010 | http://epydoc.sourceforge.net |