Re: [PATCH master] Check size limits on pre-existing partitions

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

 



> diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
> index a0cbdfa..b000573 100644
> --- a/pyanaconda/storage/__init__.py
> +++ b/pyanaconda/storage/__init__.py
> @@ -1102,6 +1102,14 @@ class Storage(object):
>                                  % {'mount': mount, 'size': size,
>                                     'productName': productName})
>  
> +        for (mount, device) in filesystems.items():
> +            problem = filesystems[mount].checkSize()
> +            if problem:
> +                errors.append(_("Your %s partition is too %s for %s formatting "
> +                                "(allowable size is %d MB to %d MB)")
> +                              % (mount, problem, device.format.name,
> +                                 device.minSize, device.maxSize))
> +
>          usb_disks = []
>          firewire_disks = []
>          for disk in self.disks:
> diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
> index 80bb7be..303856b 100644
> --- a/pyanaconda/storage/devices.py
> +++ b/pyanaconda/storage/devices.py
> @@ -932,6 +932,19 @@ class StorageDevice(Device):
>                      break
>          return grow
>  
> +    def checkSize(self):
> +        """ Check to make sure the size of the device is allowed by the
> +            format used.
> +
> +            return None is all is ok
> +            return large or small depending on the problem
> +        """
> +        problem = None
> +        if self.format.maxSize and self.size > self.format.maxSize:
> +            problem = _("large")
> +        elif self.format.minSize and self.size < self.format.minSize:
> +            problem = _("small")
> +        return problem
>  
>  class DiskDevice(StorageDevice):
>      """ A disk """

This style is going to be hell on translators, as they're being asked
to drop a word into the middle of a sentence.  You'd probably be better
off giving checkSize some sort of strcmp-like return value (-1, 0, 1)
and forming a string based on that in the caller.

- Chris

_______________________________________________
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