def event_error_tracking_create(request): record = EventErrorTracking() record.user_id = get_logged_user_id(request) _update_record(request, record) # The object this tracking item is for. event_error = DBSession.query(EventError).filter( EventError.id == record.event_error_id).first() new_state = getattr(record, 'new_state', None) if new_state: # Change the state of the event error. event_error.state = new_state if record.user_id != event_error.responsible_id: # Update the responsible of the event error. event_error.responsible_id = record.user_id DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def event_tracking_create(request): record = EventTracking() record.user_id = get_logged_user_id(request) _update_record(request, record) # The object this tracking item is for. event = DBSession.query(Event).filter( Event.id == record.event_id ).first() new_state = getattr(record, 'new_state', None) if new_state: # Change the state of the event. event.state = new_state if record.user_id != event.responsible_id: # Update the responsible of the event. event.responsible_id = record.user_id DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def envelope_create(request): record = Envelope() _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def input_descriptor_create(request): record = InputDescriptor() _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def event_node_create(request): record = EventNode() _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def emitter_profile_create(request): record = EmitterProfile() _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def service_create(request): record = Service() _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def emitter_create(request): record = Emitter() _update_record(request, record) record.password = gen_password(request.json_body['password']) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def role_create(request): record = Role() _update_record(request, record) record.password = gen_password(request.json_body['password']) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()
def emission_profile_create(request): record = EmissionProfile() record.owner_id = get_logged_user_id(request) _update_record(request, record) DBSession.add(record) DBSession.flush() DBSession.refresh(record) return record.as_dict()