python - Keyerror that occurs only in one dev environment -


i ran strange problem.... have following code works fine in local development , when use same in project dev server, keyerror: 'firstname' either missing silly here, or have no clue of .

def register(self,request, **kwargs):           try:                 data = self.deserialize(request, request.raw_post_data, format=request.meta.get('content_type', 'application/json'))             print data             print " reached register"             email = data['email']             password = data['password']             firstname = data['firstname']             lastname = data['lastname']             newdata = {'email' : email , 'password1': password , 'password2':password, 'firstname':firstname , 'lastname':lastname } 

the log output following:

[wed jul 31 21:42:24 2013] [error] {u'lastname': u'adams', u'password': u'pass', u'email': u'samad@g.com', u'firstname': u'sam'} [wed jul 31 21:42:24 2013] [error]  reached register [wed jul 31 21:42:24 2013] [error] error:root:'firstname' [wed jul 31 21:42:24 2013] [error] traceback (most recent call last): [wed jul 31 21:42:24 2013] [error]   file "/home/ubuntu/djangoec/userdetails/api.py", line 102, in register [wed jul 31 21:42:24 2013] [error]     firstname = data['firstname'] [wed jul 31 21:42:24 2013] [error] keyerror: 'firstname' 

phew, ideas?

your code looks 'firstname', exception says 'firstname'. note case. either real code says 'firstname' in (or real data has 'firstname' in it, or other case mismatch error), or data weird dict-like object lowercases keys on lookups. suspect it's first answer.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -