From: W. Trevor King Date: Tue, 18 May 2010 14:50:18 +0000 (-0400) Subject: Move argument_to_setting before plugin loading code in hooke.plugin. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7427e3b4a493eba6e3a04e2f526d619ad112f21;p=hooke.git 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 ;). --- 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)