sanitize get_amount
This commit is contained in:
parent
cff3d6ce31
commit
91b4019d2e
|
@ -64,11 +64,12 @@ class BTCAmountEdit(AmountEdit):
|
||||||
return "BTC" if p == 8 else "mBTC"
|
return "BTC" if p == 8 else "mBTC"
|
||||||
|
|
||||||
def get_amount(self):
|
def get_amount(self):
|
||||||
x = unicode( self.text() )
|
try:
|
||||||
if x in['.', '']:
|
x = Decimal(str(self.text()))
|
||||||
|
except:
|
||||||
return None
|
return None
|
||||||
p = pow(10, self.decimal_point())
|
p = pow(10, self.decimal_point())
|
||||||
return int( p * Decimal(x) )
|
return int( p * x )
|
||||||
|
|
||||||
def setAmount(self, amount):
|
def setAmount(self, amount):
|
||||||
p = pow(10, self.decimal_point())
|
p = pow(10, self.decimal_point())
|
||||||
|
|
Loading…
Reference in New Issue