Browse files

Hack to make mysql truncate warning go away

  • Loading branch information...
1 parent ff51d91 commit 273159282dd9c5db1e2f74f2c7c40a8d0c8a97c3 @kumar303 kumar303 committed Dec 12, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 webpay/pay/views.py
View
8 webpay/pay/views.py
@@ -58,6 +58,12 @@ def lobby(request):
iss = Issuer.objects.get(issuer_key=form.key)
except Issuer.DoesNotExist:
iss = None # marketplace
+
+ # TODO(Kumar) fix this for reals. See bug 820198.
+ desc = pay_req['request']['description']
+ if len(desc) > 255:
+ desc = desc[0:255]
@robhudson
Mozilla member

I'm used to seeing that as [:255]. And I was curious if Python optimizes for that. timeit shows it a 1/10th of a sec faster for 1m loops so maybe it does slightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
trans = Transaction.create(
state=TRANS_STATE_PENDING,
issuer=iss,
@@ -66,7 +72,7 @@ def lobby(request):
amount=Decimal(pay_req['request']['price'][0]['amount']),
currency=pay_req['request']['price'][0]['currency'],
name=pay_req['request']['name'],
- description=pay_req['request']['description'],
+ description=desc,
json_request=json.dumps(pay_req))
request.session['trans_id'] = trans.pk

0 comments on commit 2731592

Please sign in to comment.