Hello friends,

I don't know why Django is so unstable.

Before restarting my computer everything works fine. Django could parse a
simple
POST request without complaining KeyError.

I'm simply making a POST request like this:

curl -v -H "Content-Type: application/json" -A 'Mozilla' -X POST --data
'fees={"fees":{"status":"pending","timeout":5},
"hostel":{"status":"pending","timeout": 3}}'
http://127.0.0.1:8000/api/transaction/add/ > post_data.txt

I also have it in valid dict format like this:

curl -v -H "Content-Type: application/json" -X POST --data
'fees={"fees":[("status","pending"),("timeout",5)],
"hostel":[("status","pending"),("timeout", 3)]'
http://127.0.0.1:8000/api/transaction/add/ > post_data.txt

This worked throughout yesterday. Just hoping to continue from where I left
off, and I can't progress as I would love to.

Trace:

Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/api/transaction/add/

Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.humanize',
 'axes',
 'webapp',
 'djangorestframework',
 'django_tables',
 'django_tables.app',
 'pagination',
 'south',
 'djcelery']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'djangoflash.middleware.FlashMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'axes.middleware.FailedLoginMiddleware',
 'audit_log.middleware.UserLoggingMiddleware')


Traceback:
File
"C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\core\handlers\base.py"
in get_response
  111.                         response = callback(request, *callback_args,
**callback_kwargs)
File "C:\wamp\www\edupay\api\views.py" in add_transaction
  44.     req_fees = json.loads(QueryDict(request.POST.__getitem__('fees')))
File
"C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\utils\datastructures.py"
in __getitem__
  256.             raise MultiValueDictKeyError("Key %r not found in %r" %
(key, self))

Exception Type: MultiValueDictKeyError at /api/transaction/add/
Exception Value: 'Key \'fees\' not found in <QueryDict: {u\'identifier\':
[u\' \'], u\'amount\': [u\'0.0\'], u\'code\': [u\'UNIA\'], u\' fees\':
[u\'{"fees":[("status","pending"),("timeout",5)],
"hostel":[("status","pending"),("timeout", 3)]\'], u\'digest\':
[u\'5D316CD2311678A1B12F6152988F3097\']}>'

The problem is simply understandable, but why didn't Django say this when I
worked on it yesterday. This is not fair Djanjo. It is not!

Somebody please help me.

Thanks

-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde

-- 
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