Re: [PATCH 7/7] Clean up and simplify some things in the custom storage spoke.

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

 



On Mon, 2012-06-18 at 14:25 -0400, Chris Lumens wrote:
> > @@ -417,28 +421,16 @@ class CustomPartitioningSpoke(NormalSpoke):
> >  
> >          # Make sure there's something displayed on the RHS.  Just default to
> >          # the first mountpoint in the page.
> > +        # FIXME: the current page appears to be the default/empty/create page,
> > +        #        even if you've obviously gone into one of the roots to remove
> > +        #        a device
> >          page = self._accordion.currentPage()
> > -        if not page or not page._members:
> > -            return
> > -
> > -        self._populate_right_side(page._members[0])
> > +        if getattr(page, "_members", []):
> > +            self._populate_right_side(page._members[0])
> 
> This is a kind of weird phrasing.  Why don't you use hasattr instead?

This also catches the case where it has the attribute but the value is
not set to anything useful. This instance may be an unnecessary hack. It
was added to deal with CreateNewPage instances not having a _members
attribute.

> 
> > @@ -513,10 +499,13 @@ class CustomPartitioningSpoke(NormalSpoke):
> >          # Devices just created by autopartitioning will be listed as unused
> >          # since they are not yet a part of any known Root.
> >          for device in self._unusedDevices():
> > +            if device.exists:
> > +                continue
> > +
> >              if device.format.type == "swap":
> >                  swaps.append(device)
> >  
> > -            if hasattr(device.format, "mountpoint"):
> > +            if getattr(device.format, "mountpoint", None):
> >                  mounts[device.format.mountpoint] = device

This one is useful in checking for a mountpoint attr that is actually
set to something as opposed to just checking for the attr.

> 
> Likewise.
> 
> - Chris
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux