On Wednesday, February 2, 2011 2:27:16 PM UTC, Burhan wrote:
>
> Hello, I have a strange problem which I am unable to figure out. 
>
> I have a method that is POSTed some information from a third-party 
> payment gateway. The request is sent to payment-result.jsp? 
> PaymentID=342 (where 342 is any integer). 
>
> My URL pattern is: 
>
> (r'^payment-result.jsp$', result) 
>
> The method is: 
>
> @crsf_exempt 
> def result(request): 
>   print(request.POST) 
>   paymentID = request.POST['paymentid'] 
>   paymentID = request.GET['paymentid'] 
>
>   # various other calls, which redirect to a template 
>
> Now the problem is in my server log, I can see that POST is being 
> populated correctly: 
>
> #|2011-02-02T16:23:10.390+0300|INFO|glassfish3.0.1| 
> javax.enterprise.system.std.com.sun.enterprise.v3.services.impl| 
> _ThreadID=23;_ThreadName=Thread-1;|{u'result': [u'NOT CAPTURED'], 
> u'paymentid': [u'3104447221610330'], u'responsecode': [u'05'], 
> u'postdate': [u'0203'], u'udf4': [u''], u'auth': [u'000000'], 
> u'tranid': [u'883532231610330'], u'ref': [u'103316920306'], u'udf5': 
> [u''], u'trackid': [u'20110202162240167'], u'udf1': [u''], u'udf3': 
> [u''], u'udf2': [u'']} 
> |#] 
>
> However, when I try to render a template, I get the following: 
>
> Traceback: 
> File "C:\glassfishv3\glassfish\jython\Lib\site-packages\django\core 
> \handlers\base.py" in get_response 
>   100.                     response = callback(request, 
> *callback_args, **callback_kwargs) 
> File "C:\aubk\eschool\views.py" in knetResult 
>   650.     k_paymentid = request.POST['paymentid'] 
> File "C:\glassfishv3\glassfish\jython\Lib\site-packages\django\utils 
> \datastructures.py" in __getitem__ 
>   235.             raise MultiValueDictKeyError("Key %r not found in 
> %r" % (key, self)) 
>
> Exception Type: MultiValueDictKeyError at /en/payment-error.jsp 
> Exception Value: "Key 'paymentid' not found in <QueryDict: {}>" 
>
> As you can see <QueryDict: {}> is empty ... which it shouldn't be as 
> information has been posted to the system. 
>
> Environment: 
>   Django 1.2.3 
>   Sun Glassfish Server 
>   Jython 2.5.2 
>
> Thanks


The POST and GET dictionaries, like everything else in Python, are 
case-sensitive. So if the URL being posted to is
    payment-result.jsp?PaymentID=342
then you will need to do
    paymentID = request.GET['PaymentID'] 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to