Commits

Josh VanderLinden  committed e2d5651

Trying to handle some unicode junk--poorly, yes.

  • Participants
  • Parent commits 98caf11

Comments (0)

Files changed (1)

File moneybookers

 new file mode 100644
 --- /dev/null
 +++ b/satchmo/apps/payment/modules/moneybookers/views.py
-@@ -0,0 +1,156 @@
+@@ -0,0 +1,170 @@
 +import logging
 +import traceback
 +
 +
 +log = logging.getLogger('moneybookers.views')
 +
++def handle_unicode(func):
++    def wrapped(*args, **kwargs):
++        try:
++            print args, kwargs
++            func(*args, **kwargs)
++        except UnicodeDecodeError:
++            func('Unicode decoding error', exc_info=True)
++    return wrapped
++
++log.debug = handle_unicode(log.debug)
++log.error = handle_unicode(log.error)
++log.warning = handle_unicode(log.warning)
++log.info = handle_unicode(log.info)
++
 +@never_cache
 +def pay_ship_info(request):
 +    config = config_get_group('PAYMENT_MONEYBOOKERS')
 +            # payment hasn't been processed yet
 +            order = Order.objects.get(pk=invoice)
 +
-+            log.debug('Adding a payment to order "%s" for: %s' % (order, gross))
++            log.debug('Adding a payment to order %s for: %s' % (order.id, gross))
 +            order.add_status(status='New', notes=_('Paid through MoneyBookers.'))
 +            processor = get_processor_by_key('PAYMENT_MONEYBOOKERS')
 +            payment = processor.record_payment(order=order, amount=gross, transaction_id=txn_id)