def post(self): # try a file upload first model_data = self.get_model_data() logging.info(model_data) responders = self.VerifyAndStoreData(model_data) logging.info('Responders is %s' % responders) if responders: common.MaybeSendEmail(len(responders)) self.response.headers['Content-Type'] = 'text/html' self.response.out.write( template.render(self.TEMPLATE, {'responders': responders}))
def SaveChanges(self, responders): added = 0 for responder in responders: key = '%d_%d' % (responder.manufacturer.esta_id, responder.device_model_id) image = self.GetURLOrNone('%s_image' % key) url = self.GetURLOrNone('%s_url' % key) if not (image or url): continue responder_obj = UploadedResponderInfo( manufacturer_id=responder.manufacturer.esta_id, device_model_id=responder.device_model_id, upload_time=datetime.datetime.now()) if image: responder_obj.image_url = image if url: responder_obj.link_url = url logging.info('Added %s' % responder.model_description) responder_obj.put() added += 1 common.MaybeSendEmail(added)