where is the "BaseHandler.__init__" exec ?
Chris Lumens
clumens at redhat.com
Wed Apr 28 14:04:49 UTC 2010
> where is the "BaseHandler.__init__" exec ?
>
> look at the following code, after func "returnClassForVersion" have executed,
> the "commands" attr of "handler" have fixed by "command-object" mapping already.
>
> but from the line 173 to 177, there is just a imputil.imp.load_module func ,
> and the module itself haven't execute a "BaseHandler.__init__" func.
>
> how the "handler" get a fixed attr "commands" ?
returnClassForVersion just returns the class. It does not return an
instance of that class, so you have to do that yourself. Look at
makeVersion in pykickstart/version.py. That returns an instance of the
class, and that's how the handler gets a commands dict.
Look at pykickstart/base.py:BaseHandler.__init__. There,
_registerCommands is called which sets up that attr.
Does that clear things up?
- Chris
More information about the Kickstart-list
mailing list