[PATCH 3/5] Convert ContainerDevice to an abstract base class.
David Lehman
dlehman at redhat.com
Sat Mar 29 02:45:05 UTC 2014
On Fri, 2014-03-28 at 17:31 -0700, Brian C. Lane wrote:
> On Mon, Mar 24, 2014 at 01:50:50PM -0500, David Lehman wrote:
> > _type = "lvmvg"
> > _packages = ["lvm2"]
> > - _formatClassName = "lvmpv"
> > - _formatUUIDAttr = "vgUuid"
> > + _formatClassName = property(lambda s: "lvmpv")
> > + _formatUUIDAttr = property(lambda s: "vgUuid")
>
> Why create these like this? Is it a abc thing? And if so, why not _type
> too?
abc requires that subclasses implement every method and property
implemented by the abc -- or at least that's my understanding of it --
so this forces subclasses to define these for themselves. I didn't
extend it to type or anything else because I was only concerned with the
bits that are unique to ContainerDevice. It may be possible to just
override the properties with normal attributes in the subclass, but I
didn't try that. abc appears to be all about being rigid and explicit,
so I was just going with the program.
More information about the anaconda-patches
mailing list