Hey, I'm fairly new to python I have this piece of code which stores the birth info to the datastore in Google App Engine. The code works but is it the correct way to do it? Is there a simpler way to do it, to make sure that the key exists before storing it in datastore?
def store_birthinfo(self, user, birthday):
"""
Store birthinfo
"""
name = ''
date = ''
place = ''
country = ''
for key in birthday.keys():
if key == 'name':
name = birthday['name']
elif key == 'date':
date = birthday['date']
elif key == 'place':
place = birthday['place']
elif key == 'country':
country = birthday['country']
birthinfo = BirthInfo(user = user,
date = date,
place = place,
country = country)
birthinfo.put()