tMerge pull request #1229 from kyuupichan/uri-format - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e13e42a00c84d4a1aa9afc1e69c0caf176dddd6e DIR parent c7b33a9e4a2956b79356e6e3c2fb1e192f731097 HTML Author: ThomasV <electrumdev@gmail.com> Date: Fri, 22 May 2015 08:12:09 +0200 Merge pull request #1229 from kyuupichan/uri-format Plain number formatting for URIs. Diffstat: M lib/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- DIR diff --git a/lib/util.py b/lib/util.py t@@ -104,8 +104,10 @@ def user_dir(): #raise Exception("No home directory found in environment variables.") return - - +def format_satoshis_plain(x): + '''Display a satoshi amount in BTC with 8 decimal places. Always + uses a '.' as a decimal point and has no thousands separator''' + return "{:.8f}".format(x / 100000000.0) def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False): from locale import localeconv t@@ -273,7 +275,7 @@ def create_URI(addr, amount, message): return "" query = [] if amount: - query.append('amount=%s'%format_satoshis(amount)) + query.append('amount=%s'%format_satoshis_plain(amount)) if message: if type(message) == unicode: message = message.encode('utf8')