[blivet] Use given format type as format's name instead of type
David Shea
dshea at redhat.com
Wed Nov 27 17:03:48 UTC 2013
On 11/27/2013 09:29 AM, Vratislav Podzimek wrote:
> Format's type is a strictly set value we define in our classes. Format's name is
> a description that can be presented to users instead of type. If we get type
> from the outside and cannot find a matching class in our formats, we should set
> the type as format's name and let the type unset because many pieces of code
> rely on the type being None in case we don't understand/support the format.
>
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
> blivet/formats/__init__.py | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
> index e340f76..10fa5fc 100644
> --- a/blivet/formats/__init__.py
> +++ b/blivet/formats/__init__.py
> @@ -78,8 +78,8 @@ def getFormat(fmt_type, *args, **kwargs):
>
> device -- path to the device on which the format resides
> uuid -- the UUID of the (preexisting) formatted device
> - exists -- whether or not the format exists on the device
> -
> + exists -- whether or not the format exists on the device
> +
> """
> fmt_class = get_device_format_class(fmt_type)
> fmt = None
> @@ -93,9 +93,9 @@ def getFormat(fmt_type, *args, **kwargs):
> # this allows us to store the given type for formats we implement as
> # DeviceFormat.
> if fmt_type and fmt.type is None:
> + # uknown type, but we can set the name of the format
> # this should add/set an instance attribute
> - fmt._type = fmt_type
> - fmt._name = None
> + fmt._name = fmt_type
>
> log.debug("getFormat('%s') returning %s instance" % (fmt_type, className))
> return fmt
I retract my previous comment about this
(https://lists.fedorahosted.org/pipermail/anaconda-patches/2013-November/007518.html,
which never got to my email client for some reason): it's more important
that fmt._type be None in this case, and the extra gettext lookups won't
matter for the unknown strings. Ack.
More information about the anaconda-patches
mailing list