def put(self, slug): app.logger.debug('putting multiple tasks') app.logger.debug(len(request.data)) # Get the posted data taskdata = json.loads(request.data) for task in taskdata: parse_task_json(task, slug, task['identifier'], commit=False) # commit all dirty tasks at once. db.session.commit()
def put(self, slug): # Get the posted data data = json.loads(request.data) # debug output number of tasks being posted app.logger.debug('posting {number} tasks...'.format(number=len(data))) if len(data) > app.config['MAX_TASKS_BULK_UPDATE']: abort(400, 'more than 5000 tasks in bulk update') for task in data: db.session.merge(parse_task_json(slug, task)) # commit all dirty tasks at once. db.session.commit() return {}, 200
def put(self, slug, identifier): """Create or update one task.""" # Parse the posted data parse_task_json(json.loads(request.data), slug, identifier) return {}, 201
def put(self, slug, identifier): """Create or update one task.""" # Parse the posted data db.session.add(parse_task_json(slug, json.loads(request.data))) return {}, 201