From d09d5e5dacf16e9a6657e3892c45815047304682 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Fri, 22 May 2015 14:32:47 +0900 Subject: [PATCH] Plain number formatting for URIs. --- lib/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/util.py b/lib/util.py index 68e11bde..154073d0 100644 --- a/lib/util.py +++ b/lib/util.py @@ -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 @@ -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')