def _create_spoogler(self, template_context, token_value): """Creates an instance of a Spoogler in the Datastore.""" write_success = False # Instantiation of the Spoogler class: spoogler = Spoogler( full_name=template_context['full_name'], spoogler_email=template_context['spoogler_email'], spoogler_fb_email=template_context['spoogler_fb_email'], same_as_spoogler_email=template_context['same_as_spoogler_email'], googler_full_name=template_context['googler_full_name'], googler_ldap=template_context['googler_ldap'], spoogler_country=template_context['spoogler_country'], spoogler_us_state=template_context['spoogler_us_state'], work_status=template_context['work_status'], english_proficiency=template_context['english_proficiency'], native_lang=template_context['native_lang'], native_lang_other=template_context['native_lang_other'], address=template_context['address'], other_address=template_context['other_address'], time_in_area=template_context['time_in_area'], spoogler_relo=template_context['spoogler_relo'], support_others=template_context['support_others'], support_others_other=template_context['support_others_other'], kidszone_invite=template_context['kidszone_invite'] == 1, # it needs to be converted to bool here spoogler_is_parent=template_context['spoogler_is_parent'], children_ages=template_context['children_ages'], status=0, token=token_value, test=template_context['test'], ) logging.info(spoogler.work_status) # An entity is persisted in the Datastore: try: spoogler.put() write_success = True except datastore_errors.TransactionFailedError: self.response.out.write('Something went wrong, please try again') return write_success