/usr/share/pyshared/configglue/app/plugin.py is in python-configglue 1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ###############################################################################
#
# configglue -- glue for your apps' configuration
#
# A library for simple, DRY configuration of applications
#
# (C) 2009--2011 by Canonical Ltd.
# by John R. Lenton <john.lenton@canonical.com>
# and Ricardo Kirkner <ricardo.kirkner@canonical.com>
#
# Released under the BSD License (see the file LICENSE)
#
# For bug reports, support, and new releases: http://launchpad.net/configglue
#
###############################################################################
from configglue.schema import Schema
__all__ = [
'Plugin',
'PluginManager',
]
class Plugin(object):
schema = Schema
enabled = False
class PluginManager(object):
def __init__(self):
self.available = self.load()
@property
def enabled(self):
return [cls for cls in self.available if cls.enabled]
def enable(self, plugin):
plugin.enabled = True
def disable(self, plugin):
plugin.enabled = False
@property
def schemas(self):
return [cls.schema for cls in self.enabled]
def load(self):
return []
def register(self, plugin):
if plugin not in self.available:
self.available.append(plugin)
|