API Documentation

Message

class shout.Message(*args, **kwargs)

Message s keep track of their listeners and the various rooms they are listening to. Instances of Message hold args and kwargs and when shout() is called these are passed to all the appropraite listeners. All return values of listeners are collected in response. If all listeners execute correctly success is set to True. Any Exception raised by a listener will halt the shout after binding exc to the offending Exception.

Parameters:
  • args – Arguments to shout
  • kwargs – Keyword Arguments to shout
static create(name)

Dynamically create a new type of Message.

Parameters:name – The __class__.__name__ to use.
shout()

Sends the instances args and kwargs to the appropriate listeners.

hears

shout.hears(*args, **kwargs)

Decorates functions and methods, adding them as listeners to the specified Message s.

Parameters:
  • argsMessage s this function will hear.
  • inside – Tuple of rooms this function will hear.

has_ears

shout.has_ears(cls)

Class decorator that enables hears() decorator to be used on class methods.

shout

shout.shout(msg_type, *args, **kwargs)

A grammatically pleasant way to shout a Message.

shout(Message, “Hello”, inside=”A”) == Message(“Hello”, inside=”A”).shout()

Parameters:
  • msg_type – The type of Message to shout.
  • args – The args to pass to the Message.
  • kwargs – The kwargs to pass to the Message.
  • inside – The rooms to shout inside.

shout_logging