use request.raw_post_data, access it before request.POST

This commit is contained in:
Jeff Balogh 2011-05-03 14:55:21 -07:00
Родитель 6a14cb15b2
Коммит fbc115612f
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -254,10 +254,12 @@ def _paypal(request):
if request.method != 'POST':
return http.HttpResponseNotAllowed(['POST'])
post = request.POST.copy()
# raw_post_data has to be accessed before request.POST. wtf django?
raw, post = request.raw_post_data, request.POST.copy()
# Check that the request is valid and coming from PayPal.
data = u'cmd=_notify-validate&%s' % post.urlencode()
# The order of the params has to match the original request.
data = u'cmd=_notify-validate&' + raw
paypal_response = urllib2.urlopen(settings.PAYPAL_CGI_URL,
data, 20).readline()