# HG changeset patch # User Thierry Florac # Date 1366536264 -7200 # Node ID 0c2257bf3762e1ab3a1f9825e0718a243de98b36 # Parent 15d4527f4fbe382b74afb5bbcdc40e41c83d16b2 Corrected getHumanSize() function when provided request diff -r 15d4527f4fbe -r 0c2257bf3762 docs/HISTORY.txt --- a/docs/HISTORY.txt Sun Apr 21 11:22:41 2013 +0200 +++ b/docs/HISTORY.txt Sun Apr 21 11:24:24 2013 +0200 @@ -1,6 +1,10 @@ Changelog ========= +0.4.2 +----- + - small correction in getHumanSize() function + 0.4.1 ----- - use request locale formatter in getHumanSize function diff -r 15d4527f4fbe -r 0c2257bf3762 src/ztfy/utils/size.py --- a/src/ztfy/utils/size.py Sun Apr 21 11:22:41 2013 +0200 +++ b/src/ztfy/utils/size.py Sun Apr 21 11:24:24 2013 +0200 @@ -33,10 +33,10 @@ """Convert given bytes value in human readable format""" if request is None: request = queryRequest() - if request is not None: - formatter = request.locale.numbers.getFormatter('decimal') - else: - formatter = None + if request is not None: + formatter = request.locale.numbers.getFormatter('decimal') + else: + formatter = None if value < 1024: return translate(_("%d bytes"), context=request) % value value = value / 1024.0