Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Commit 3a3e095

Browse files
author
Andy McKay
committed
cope with unicode junk in the amount field (bug 724062)
1 parent 7e66888 commit 3a3e095

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

apps/paypal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def add_receivers(chains, email, amount, uuid, preapproval=False):
9292
"""
9393
try:
9494
remainder = Decimal(str(amount))
95-
except InvalidOperation, msg:
95+
except (UnicodeEncodeError, InvalidOperation), msg:
9696
raise PaypalDataError(msg)
9797

9898
result = {}

apps/paypal/tests/test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ def test_error_currency(self, _call):
219219
data['currency'] = 'xxx'
220220
self.assertRaises(paypal.CurrencyError, paypal.get_paykey, data)
221221

222+
def test_error_currency_junk(self):
223+
for v in [u'\u30ec\u30b9', 'xysxdfsfd']:
224+
self.assertRaises(paypal.PaypalDataError,
225+
paypal.add_receivers,
226+
[], 'f@foo.com', v, '')
227+
222228

223229
class TestPurchase(amo.tests.TestCase):
224230

0 commit comments

Comments
 (0)