On Tue, 13 May 2008, Jeremy Katz wrote:
On Tue, 2008-05-13 at 10:04 +0200, Joel Andres Granados wrote:
nextvalidpartition = next_partition(validonly=true)
nextpartition = next_partition()
my point being that the check for the validity of the partition, IMO, is better
put inside pyparted and not in a higher level. This does not change the semantics
of the current calls. the next_partition() will still work and will still return
the next partition, valid or invalid. So stuff that uses that function will not
be invalid after the change. It does change the semantics of the calls where we
want to ensure that the next partition is valid, it additionally does away with
the couple of lines that check for the validity.
For the new API, we should just get rid of the next_partition() stuff
altogether and do something iterator based --
for p in disk.partitions
would be oh so nice :) And at that point, we could make that just
return active partitions[1], leaving the special cases to use a special
case API. But, veering off the course now
Yes, please don't reimplement the crufty old next_partition() stuff. The
partitions should be in a container class that implements __len__(),
__getitem__(), etc.
I ended up having to wrap this in my own container class in the past and
I'd love to get the 200 lines of code back.
--Patrick.
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list