[PATCH] Initialize cmd.handler earlier; fixes repo.methodToRepo()
Mark McLoughlin
markmc at redhat.com
Mon Apr 21 07:57:59 UTC 2008
FC8_Repo.methodToRepo() references self.handler.method
which, since a commands "handler" attribute is only
initialized by BaseHandler.dispatcher(), means that a "repo"
command must have been parsed before methodToRepo() is
called.
Clearly this is an invalid assumption - a kickstart may not
contain any "repo" commands if e.g. it only has a "url"
command.
Fix this by making a commands "handler" attribute be
initialized as soon as the command is registered during the
BaseHandler constructor.
Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
pykickstart/base.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pykickstart/base.py b/pykickstart/base.py
index 54ce86d..26e8d58 100644
--- a/pykickstart/base.py
+++ b/pykickstart/base.py
@@ -302,6 +302,7 @@ class BaseHandler:
# Finally, add the mapping to the commands dict.
self.commands[cmdName] = cmdObj
+ self.commands[cmdName].handler = self
# We also need to create attributes for the various data objects.
# No checks here because dMap is a bijection. At least, that's what
@@ -323,7 +324,6 @@ class BaseHandler:
elif self.commands[cmd] != None:
self.commands[cmd].currentCmd = cmd
self.commands[cmd].currentLine = self.currentLine
- self.commands[cmd].handler = self
self.commands[cmd].lineno = lineno
self.commands[cmd].parse(args[1:])
--
1.5.4.5
More information about the Kickstart-list
mailing list