Move argument_to_setting before plugin loading code in hooke.plugin.
authorW. Trevor King <wking@drexel.edu>
Tue, 18 May 2010 14:50:18 +0000 (10:50 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 18 May 2010 14:50:18 +0000 (10:50 -0400)
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

index dc36488f2cf63e77105bd9aa71e0dcbbc42a56ad..8f6c860d4138c2fc807052d1197bc98462674956 100644 (file)
@@ -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)