Example #1
0
 def dispatch_request(self, id):
     super(WalletMoveView, self).dispatch_request(id)
     form = AccountMoveForm(request.form)
     choices = get_accounts(self.conn, getchoice=True)
     form.fromaccount.choices = choices
     form.toaccount.choices = choices
     accounts = get_accounts(self.conn, getbalance=True)
     fromaccount = urllib.unquote_plus(form.data['fromaccount'])
     toaccount = urllib.unquote_plus(form.data['toaccount'])
     fromaccount = real_format(fromaccount)
     toaccount = real_format(toaccount)
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         self.conn.move(
             fromaccount,
             toaccount,
             amount,
             int(get_setting('minconf', 6)),
             form.data['comment'],
         )
         flash(u"%f coins moved from %s to %s" % (amount,
               human_format(fromaccount), human_format(toaccount)),
               'success')
         return redirect(url_for('wallet.wallet_detail', id=id))
     return render_template("wallet/wallet/move.html", wallet=self.wallet,
                            form=form, accounts=accounts)
Example #2
0
 def dispatch_request(self, id):
     super(WalletMoveView, self).dispatch_request(id)
     form = AccountMoveForm(request.form)
     choices = get_accounts(self.conn, getchoice=True)
     form.fromaccount.choices = choices
     form.toaccount.choices = choices
     accounts = get_accounts(self.conn, getbalance=True)
     fromaccount = urllib.unquote_plus(form.data['fromaccount'])
     toaccount = urllib.unquote_plus(form.data['toaccount'])
     fromaccount = real_format(fromaccount)
     toaccount = real_format(toaccount)
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         self.conn.move(
             fromaccount,
             toaccount,
             amount,
             int(get_setting('minconf', 6)),
             form.data['comment'],
         )
         flash(
             u"%f coins moved from %s to %s" %
             (amount, human_format(fromaccount), human_format(toaccount)),
             'success')
         return redirect(url_for('wallet.wallet_detail', id=id))
     return render_template("wallet/wallet/move.html",
                            wallet=self.wallet,
                            form=form,
                            accounts=accounts)
Example #3
0
 def _test_strtofloat(self, valin, expected):
     valout = strtofloat(valin)
     self.assertEqual(
         valout, expected,
         'Coinformat of %s is %s, not %s' % (repr(valin), valout, expected))
     self.assertEqual(
         type(valout), type(expected), 'Coinformat of %s is %s, not %s' %
         (repr(valin), type(valout), type(expected)))
Example #4
0
 def _test_strtofloat(self, valin, expected):
     valout = strtofloat(valin)
     self.assertEqual(
         valout,
         expected,
         'Coinformat of %s is %s, not %s' % (repr(valin), valout, expected)
     )
     self.assertEqual(
         type(valout),
         type(expected),
         'Coinformat of %s is %s, not %s' % (repr(valin), type(valout),
                                            type(expected))
     )
Example #5
0
 def dispatch_request(self, id):
     super(WalletSendView, self).dispatch_request(id)
     form = SendForm(request.form)
     balance = self.conn.getbalance()
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         txid = self.conn.sendtoaddress(form.toaddress.data, amount,
                                        form.comment.data, form.to.data)
         flash(u"%f coins sent to %s" % (amount, form.toaddress.data),
               'success')
         return redirect(url_for("wallet.tx_detail", id=id, txid=txid))
     return render_template('wallet/wallet/send.html',
                            wallet=self.wallet,
                            form=form,
                            balance=balance)
Example #6
0
 def dispatch_request(self, id):
     super(WalletSendView, self).dispatch_request(id)
     form = SendForm(request.form)
     balance = self.conn.getbalance()
     if request.method == 'POST' and form.validate():
         amount = strtofloat(form.data['amount'])
         txid = self.conn.sendtoaddress(
             form.toaddress.data,
             amount,
             form.comment.data,
             form.to.data
         )
         flash(u"%f coins sent to %s" % (amount, form.toaddress.data),
               'success')
         return redirect(url_for("wallet.tx_detail", id=id, txid=txid))
     return render_template('wallet/wallet/send.html', wallet=self.wallet,
                            form=form, balance=balance)