def post(self): event_urlsafe = self.request.get('event') if not event_urlsafe: logging.error('No event key given.') return # TODO: Use event id rather than key here for namespacing purposes? event_key = ndb.Key(urlsafe=event_urlsafe) event = event_key.get() if not event: logging.error('Event %s not found!', event_key) return if event.status == EVENT_STATUS_CLOSED: logging.error('Event %s closed!', event_key) return marker_urlsafe = self.request.get('marker') if not marker_urlsafe: logging.error('No marker key given.') return marker_key = ndb.Key(urlsafe=marker_urlsafe) mark_as_acknowledged(event_key, marker_key)
def post(self): from sosbeacon.responde_sms import Responder from sosbeacon.event.message import Message from sosbeacon.event.contact_marker import mark_as_acknowledged from_number = self.request.get('From', None) from_body = self.request.get('Body', None) responder_sms_list = Responder.query(Responder.contact_number == from_number) responder_sms_filter = responder_sms_list.order(Responder.added).fetch() responder_sms = responder_sms_filter[-1] if responder_sms.is_admin == True: message = { 'event': responder_sms.event, 'type': 'c', 'is_student': False, 'user_name': responder_sms.contact_first_name + " " + responder_sms.contact_last_name + " - " + str(from_number), 'message': {'body': from_body}, 'longitude': '', 'latitude': '', } entity = Message.from_dict(message) entity.is_admin = True entity.user = None entity.put() return mark_as_acknowledged(responder_sms.event, responder_sms.contact_marker) message = { 'event': responder_sms.event, 'type': 'c', 'is_student': False, 'user_name': responder_sms.contact_first_name + " " + responder_sms.contact_last_name + " - " + str(from_number), 'message': {'body': from_body}, 'longitude': '', 'latitude': '', } entity = Message.from_dict(message) entity.is_admin = False entity.user = None entity.put()
def post(self): from sosbeacon.responde_sms import Responder from sosbeacon.event.message import Message from sosbeacon.event.contact_marker import mark_as_acknowledged from_number = self.request.get('From', None) from_body = self.request.get('Body', None) responder_sms_list = Responder.query( Responder.contact_number == from_number) responder_sms_filter = responder_sms_list.order( Responder.added).fetch() responder_sms = responder_sms_filter[-1] if responder_sms.is_admin == True: message = { 'event': responder_sms.event, 'type': 'c', 'is_student': False, 'user_name': responder_sms.contact_first_name + " " + responder_sms.contact_last_name + " - " + str(from_number), 'message': { 'body': from_body }, 'longitude': '', 'latitude': '', } entity = Message.from_dict(message) entity.is_admin = True entity.user = None entity.put() return mark_as_acknowledged(responder_sms.event, responder_sms.contact_marker) message = { 'event': responder_sms.event, 'type': 'c', 'is_student': False, 'user_name': responder_sms.contact_first_name + " " + responder_sms.contact_last_name + " - " + str(from_number), 'message': { 'body': from_body }, 'longitude': '', 'latitude': '', } entity = Message.from_dict(message) entity.is_admin = False entity.user = None entity.put()