1.1 --- a/moinformat/links/manifest.py Mon Jul 30 23:19:51 2018 +0200
1.2 +++ b/moinformat/links/manifest.py Tue Jul 31 00:00:49 2018 +0200
1.3 @@ -19,29 +19,17 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from moinformat.imports import get_extensions
1.8 -from os.path import split
1.9 -
1.10 -reserved = ["__init__", "common", "manifest"]
1.11 -
1.12 -# Obtain details of this module's package.
1.13 -
1.14 -dirname = split(__file__)[0]
1.15 -package = __name__.rsplit(".", 1)[0]
1.16 +from moinformat.imports import get_extensions, get_mapping, get_modules
1.17
1.18 # Define an attribute mapping names to modules.
1.19
1.20 -modules = {}
1.21 -get_extensions(dirname, package, modules, reserved)
1.22 +modules = get_modules(__file__, __name__)
1.23
1.24 # Obtain all linkers.
1.25
1.26 -linkers = {}
1.27 -
1.28 -# Use names declared in each handler to register the handlers:
1.29 +# Use names declared in each class to register the linkers:
1.30 # linker.name -> linker
1.31
1.32 -for module in modules.values():
1.33 - linkers[module.linker.name] = module.linker
1.34 +linkers = get_mapping(modules, lambda n, m: m.linker.name, lambda m: m.linker)
1.35
1.36 # vim: tabstop=4 expandtab shiftwidth=4