ibid.core – Ibid Core

This module contains Ibid’s startup code, plugin, source, config, and DB loading as well as the Event dispatcher.


ibid.core.process(event, log)

This function takes event and passes it to the process() function in each processor, in order of increasing priority. Messages are logged on the logger log.

After each Processor, any unclean SQLAlchemy sessions are committed and exceptions logged.

class ibid.core.Dispatcher

The Ibid Event dispatcher.

call_later(delay, callable, oldevent, *args, **kwargs)

Run callable after delay seconds, passing it oldevent and *args and *kwargs.

Returns a twisted.internet.base.DelayedCall.

Can be used in plugins instead of blocking in sleep.

Internal Functions


The core of the dispatcher, must be called from a worker thread.

This function takes event and passes it to the process() function. Any responses attached to event are then dispatched to their destination sources.


Dispatches response to the appropriate source.


Called by sources to dispatch event. Calls _process(), deferred to a thread, and returns the twisted.internet.defer.Deferred.

ibid.core.delayed_call(callable, event, *args, **kwargs)

The method called by call_later(), in a thread, to call callable, then _process() on event.


Dispatches responses from delayed_call().


class ibid.core.Reloader

The center of Ibid’s bootstrap process, the reloader loads plugins and processors. They can be reloaded at any time.


Boostrap Ibid and run the reactor.


Reload the Ibid dispatcher.

load_source(name[, service])

Load source of name name, setting the service parent to service.


Load all enabled sources, setting the service parents to service.

Sources can be disabled by setting the configuration key service.``disabled = True``.


Unload source of name name.


Re-load source of name name.

load_processors([load, noload, autoload])

Load all enabled processors, according to the rules in load_processor().

load specifies the plugins to force loading, noload plugins to skip loading, and autoload whether to load everything by default. If these parameters are not supplied or are None, they will be looked up as configuration keys in the plugins block.

load_processor(name, [noload, load, load_all=False,

Load the plugin of name name. Individual Processors can be disabled by listing them in noload. If they are marked with autoload = False, then they are skipped unless listed in load or load_all is True.


Unload plugin of name name.


Reload the Databases.


Reload the ibid.auth.


Notify all processors of a configuration reload, by calling setup().


ibid.core.regexp(pattern, item)

Regular Expression function for SQLite.


Connect to a SQLite database, with regular expression support, thanks to regexp().

class ibid.core.DatabaseManager(check_schema_versions=True)

The DatabaseManager is responsible for loading databases (usually only one, 'ibid'), and is a dict of database to sqlalchemy.orm.scoping.ScopedSessions.


Load the database of name name.

Echoing is configured by debugging.sqlalchemy_echo.

Databases are configured as sanely as possible:

  • All databases are brought up in a UTF-8 mode, with UTC timezone.
  • MySQL has the default engine set to InnoDB and ANSI mode enabled.