[blivet] Convert the string representation of Size to a str type. (#1060382)
Vratislav Podzimek
vpodzime at redhat.com
Mon Feb 3 12:29:04 UTC 2014
On Mon, 2014-02-03 at 10:45 +0100, David Shea wrote:
> The return value of Size.humanReadable is sometimes a unicode, since the
> translated units need to be unicode in order for upper/lower to work.
> Convert the value back to a str so that __str__ conversions don't get
> confused.
> ---
> blivet/size.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/blivet/size.py b/blivet/size.py
> index e7b6d30..dd19201 100644
> --- a/blivet/size.py
> +++ b/blivet/size.py
> @@ -207,7 +207,7 @@ class Size(Decimal):
> return self
>
> def __str__(self, context=None):
> - return self.humanReadable()
> + return str(self.humanReadable())
>
> def __repr__(self):
> return "Size('%s')" % self
Is it okay to just call str() on those unicode objects? Or do we need
decode("utf-8")?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list