~ubuntuone-control-tower/desktopcouch/trunk

« back to all changes in this revision

Viewing changes to desktopcouch/application/plugins/__init__.py

When running plugin code in initializing the desktopcouch service, do not call any functions that require that the service be running and answering DBus method calls. In particular, we already know the port couchdb is listening on, so do not ask for that via DBus client call, but explicity pass it into the plugin function calls. (LP: #706939)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
DESKTOPCOUCH_PLUGIN_PATHS = [os.path.join(os.path.dirname(__file__))]
20
20
 
21
21
 
22
 
def load_plugins():
 
22
def load_plugins(couchdb_port):
23
23
    """Load the desktopcouch application plug-ins."""
24
24
    plugin_names = set()
25
25
    for path in DESKTOPCOUCH_PLUGIN_PATHS:
37
37
        modpath = name.replace(os.path.sep, '.')[:-3]
38
38
        try:
39
39
            plugin = __import__(modpath, None, None, [''])
40
 
            plugin.plugin_init()
 
40
            plugin.plugin_init(couchdb_port)
41
41
        except (ImportError, AttributeError):
42
42
            logging.warning('Failed to load plug-in: %s', modpath)