- for student in contact.body['student']:
- for attr in ('first_name', 'last_name', 'email'):
- current['student_' + attr] = student[attr]
- if current not in toret:
- toret.append(current)
- current = {}
+ if 'student' in contact.body:
+ for student in contact.body['student']:
+ for attr in ('first_name', 'last_name', 'email'):
+ current['student_' + attr] = student[attr]
+ if current not in toret:
+ toret.append(current)
+ current = {}