[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-tools] Re: [Xen-devel] [PATCH] rework xen/xm/main.py to be more straight forward
> #3 has the nice side-effect of ensuring that xmlib is completely > documented which makes xmlib the perfect python interface for management > tools. It would be even nicer if the arguments were expanded instead of > passed as a list so the functions could be called in a more natural way. Just remembered what else I was going to say earlier: If you do: function_name(*arg_list) it'll expand the list into separate args, so you can do exactly that. (side note: a "**" will cause a dictionary to be expanded into a list of multiple named arguments) See, Python Is Your Friend :-) Cheers, Mark > A short help can be autogenerated by only grabbing the first sentence of > __doc__. > > Aliases could be supported with module-level variables assigned to the > function they alias. However, I don't like aliases so I'd just not do > anything. > > One thing this would break is abbrevation but I'm quite sure Mark is the > only one using them :-) > > Regards, > > Anthony Liguori > > Sean Dague wrote: > >The following patch is a major restructuring of main.py to be more > > straight forward, and remove as much code as possible. It does a number > > of things: > > > >* It implements the standardized options proposed via my RFC for xm > >* It restructures the calling of these functions to be function pointers > > out of a dictionary, instead of subclasses found through inspection * It > > consolidates all help info, making it easier to see that the help screen > > looks consistent across commands > >* It moves object importing into the functions that require them only, > > allowing commands like "xm help" to be runable as non root > >* It adds command aliasing to provide backwards compatibility with many > > commands (i.e. xm balloon) > >* It provides more useful error messages is most fail cases > >* It implements a short help by default (which takes < 24 screen lines) as > > requested by Mark W at OLS > >* It attempts to trap more exceptions than before and provide useful > > errors based on them (this requires more testing) > > > >It also has the added benefit of dropping the total size of main.py from > >935 lines to 694 lines. > > > >This patch makes no changes to any other elements of xen/xm, and works > > with all other objects and libraries as is. _______________________________________________ Xen-tools mailing list Xen-tools@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-tools
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |