Back to index

moin  1.9.0~rc2
Namespaces | Classes | Functions | Variables
MoinMoin.events Namespace Reference

Namespaces

namespace  emailnotify
namespace  jabbernotify
namespace  notification
namespace  xapian_index

Classes

class  Event
class  PageEvent
class  PageChangedEvent
class  TrivialPageChangedEvent
class  PageRenamedEvent
class  PageDeletedEvent
class  PageCopiedEvent
class  FileAttachedEvent
class  FileRemovedEvent
class  PageRevertedEvent
class  SubscribedToPageEvent
class  JabberIDSetEvent
class  JabberIDUnsetEvent
class  UserCreatedEvent
class  PagePreSaveEvent
class  EventResult
class  Abort

Functions

def get_handlers
def send_event
def get_subscribable_events

Variables

tuple logging = log.getLogger(__name__)
tuple modules = pysupport.getPackageModules(__file__)
 _ = lambdax:x

Function Documentation

Create a list of available event handlers.

Each handler is a handle() function defined in a plugin,
pretty much like in case of actions.

TODO: maybe make it less dumb? ;-)

Definition at line 221 of file __init__.py.

00221 
00222 def get_handlers(cfg):
00223     """Create a list of available event handlers.
00224 
00225     Each handler is a handle() function defined in a plugin,
00226     pretty much like in case of actions.
00227 
00228     TODO: maybe make it less dumb? ;-)
00229     """
00230     event_handlers = []
00231     names = wikiutil.getPlugins("events", cfg)
00232 
00233     for name in names:
00234         try:
00235             handler = wikiutil.importPlugin(cfg, "events", name, "handle")
00236         except PluginAttributeError:
00237             handler = None
00238 
00239         if handler is not None:
00240             event_handlers.append(handler)
00241 
00242     return event_handlers
00243 

Create and return a list of user-visible events

@return: A list of user-visible events described by dictionaries
@rtype: dict

Definition at line 267 of file __init__.py.

00267 
00268 def get_subscribable_events():
00269     """Create and return a list of user-visible events
00270 
00271     @return: A list of user-visible events described by dictionaries
00272     @rtype: dict
00273     """
00274     defs = globals()
00275     subscribable_events = {}
00276 
00277     for ev in defs.values():
00278         if type(ev) is type and issubclass(ev, Event) and ev.__dict__.has_key("description") and ev.__dict__.has_key("name"):
00279             subscribable_events[ev.name] = {'desc': ev.description, 'superuser': ev.req_superuser}
00280 
00281     return subscribable_events
00282 
# Get rid of the dummy getText so that it doesn't get imported with *
def MoinMoin.events.send_event (   event)
Function called from outside to process an event

@return: a list of messages returned by handlers
@rtype: list

Definition at line 244 of file __init__.py.

00244 
00245 def send_event(event):
00246     """Function called from outside to process an event
00247 
00248     @return: a list of messages returned by handlers
00249     @rtype: list
00250     """
00251 
00252     # A list of messages generated by event handlers, passed back to caller
00253     msg = []
00254     cfg = event.request.cfg
00255 
00256     # Try to handle the event with each available handler (for now)
00257     for handle in cfg.event_handlers:
00258         retval = handle(event)
00259 
00260         assert retval is None or isinstance(retval, EventResult)
00261 
00262         if retval:
00263             msg.append(retval)
00264 
00265     return msg
00266 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

MoinMoin.events._ = lambdax:x

Definition at line 24 of file __init__.py.

Definition at line 13 of file __init__.py.

tuple MoinMoin.events.modules = pysupport.getPackageModules(__file__)

Definition at line 20 of file __init__.py.