mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
Merge pull request #1229 from kyuupichan/uri-format
Plain number formatting for URIs.
This commit is contained in:
commit
e13e42a00c
1 changed files with 5 additions and 3 deletions
|
@ -104,8 +104,10 @@ def user_dir():
|
||||||
#raise Exception("No home directory found in environment variables.")
|
#raise Exception("No home directory found in environment variables.")
|
||||||
return
|
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):
|
def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
|
||||||
from locale import localeconv
|
from locale import localeconv
|
||||||
|
@ -273,7 +275,7 @@ def create_URI(addr, amount, message):
|
||||||
return ""
|
return ""
|
||||||
query = []
|
query = []
|
||||||
if amount:
|
if amount:
|
||||||
query.append('amount=%s'%format_satoshis(amount))
|
query.append('amount=%s'%format_satoshis_plain(amount))
|
||||||
if message:
|
if message:
|
||||||
if type(message) == unicode:
|
if type(message) == unicode:
|
||||||
message = message.encode('utf8')
|
message = message.encode('utf8')
|
||||||
|
|
Loading…
Add table
Reference in a new issue