Re: where is the "BaseHandler.__init__" exec ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux