From c7427e3b4a493eba6e3a04e2f526d619ad112f21 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 18 May 2010 10:50:18 -0400 Subject: [PATCH] Move argument_to_setting before plugin loading code in hooke.plugin. Otherwise Python loads the plugins before argument_to_setting has been defined, which makes it hard for the plugins to use the function ;). --- hooke/plugin/__init__.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/hooke/plugin/__init__.py b/hooke/plugin/__init__.py index dc36488..8f6c860 100644 --- a/hooke/plugin/__init__.py +++ b/hooke/plugin/__init__.py @@ -113,6 +113,19 @@ class Builtin (Plugin): """ pass +# Plugin utility functions + +def argument_to_setting(section_name, argument): + """Convert an :class:`~hooke.command.Argument` to a + `~hooke.conf.Setting`. + + This is a lossy transition, because + :class:`~hooke.command.Argument`\s store more information than + `~hooke.conf.Setting`\s. + """ + return Setting(section_name, option=argument.name, value=argument.default, + help=argument._help) + # Construct plugin dependency graph and load plugin instances. PLUGIN_GRAPH = construct_graph( @@ -159,14 +172,3 @@ def load_graph(graph, config, include_section): pass items.append(item) return items - -def argument_to_setting(self, section_name, argument): - """Convert an :class:`~hooke.command.Argument` to a - `~hooke.conf.Setting`. - - This is a lossy transition, because - :class:`~hooke.command.Argument`\s store more information than - `~hooke.conf.Setting`\s. - """ - return Setting(section_name, option=argument.name, value=argument.default, - help=argument._help) -- 2.26.2