[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Initialize cmd.handler earlier; fixes repo.methodToRepo()
- From: Mark McLoughlin <markmc redhat com>
- To: Chris Lumens <clumens redhat com>
- Cc: kickstart-list redhat com, Jesse Keating <jkeating redhat com>, Mark McLoughlin <markmc redhat com>
- Subject: [PATCH] Initialize cmd.handler earlier; fixes repo.methodToRepo()
- Date: Mon, 21 Apr 2008 08:57:59 +0100
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 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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]