def _process_POST(self): """Create new timetable entry""" data = request.json required_keys = {'start_dt'} allowed_keys = {'start_dt', 'contribution_id', 'session_block_id', 'force'} if set(data.viewkeys()) > allowed_keys: raise BadRequest('Invalid keys found') elif required_keys > set(data.viewkeys()): raise BadRequest('Required keys missing') updates = {'start_dt': dateutil.parser.parse(data['start_dt'])} if 'contribution_id' in data: updates.update(self._get_contribution_updates(data)) # TODO: breaks & session blocks else: raise BadRequest('No object specified') entry = create_timetable_entry(self.event, updates) return jsonify(start_dt=entry.start_dt.isoformat(), id=entry.id)
def _process_POST(self): """Create new timetable entry""" data = request.json required_keys = {'start_dt'} allowed_keys = {'start_dt', 'contribution_id', 'session_block_id', 'force'} if data.viewkeys() > allowed_keys: raise BadRequest('Invalid keys found') elif required_keys > data.viewkeys(): raise BadRequest('Required keys missing') updates = {'start_dt': dateutil.parser.parse(data['start_dt'])} if 'contribution_id' in data: updates.update(self._get_contribution_updates(data)) # TODO: breaks & session blocks else: raise BadRequest('No object specified') entry = create_timetable_entry(self.event_new, updates) return jsonify(start_dt=entry.start_dt.isoformat(), id=entry.id)