Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args = parser.parse_args()
play = Play.query.get(args.id)
if not play:
abort(404, message="Play {} doesn't exist".format(args.id),
help=api_utils.help(parser.args, PLAY_FIELDS))
keys = ['name', 'started', 'ended']
updates = 0
for key in keys:
if getattr(args, key) is not None:
updates += 1
setattr(play, key, getattr(args, key))
if not updates:
abort(400, message="No parameters to update provided",
help=api_utils.help(parser.args, PLAY_FIELDS))
db.session.add(play)
db.session.commit()
return self.get(id=play.id)
"""
parser = self._get_parser()
if id is not None:
play = _find_plays(id=id)
if play is None:
abort(404, message="Play {} doesn't exist".format(id),
help=api_utils.help(parser.args, PLAY_FIELDS))
return marshal(play, PLAY_FIELDS)
args = parser.parse_args()
plays = _find_plays(**args)
if not plays:
abort(404, message="No plays found for this query",
help=api_utils.help(parser.args, PLAY_FIELDS))
return marshal(plays, PLAY_FIELDS)
def get(self, id=None):
"""
Retrieves one or many records based on the request and the query
"""
parser = self._get_parser()
if id is not None:
record = _find_records(id=id)
if record is None:
abort(404, message="Record {} doesn't exist".format(id),
help=api_utils.help(parser.args, RECORD_FIELDS))
return marshal(record, RECORD_FIELDS)
args = parser.parse_args()
records = _find_records(**args)
if not records:
abort(404, message="No records found for this query",
help=api_utils.help(parser.args, RECORD_FIELDS))
return marshal(records, RECORD_FIELDS)
def get(self, id=None):
"""
Retrieves one or many results based on the request and the query
"""
parser = self._get_parser()
if id is not None:
result = _find_results(id=id)
if result is None:
abort(404, message="Result {} doesn't exist".format(id),
help=api_utils.help(parser.args, RESULT_FIELDS))
return marshal(result, RESULT_FIELDS)
args = parser.parse_args()
results = _find_results(**args)
if not results:
abort(404, message="No results found for this query",
help=api_utils.help(parser.args, RESULT_FIELDS))
return marshal(results, RESULT_FIELDS)
"""
parser = self._get_parser()
if id is not None:
playbook = _find_playbooks(id=id)
if playbook is None:
abort(404, message="Playbook {} doesn't exist".format(id),
help=api_utils.help(parser.args, PLAYBOOK_FIELDS))
return marshal(playbook, PLAYBOOK_FIELDS)
args = parser.parse_args()
playbooks = _find_playbooks(**args)
if not playbooks:
abort(404, message='No playbooks found for this query',
help=api_utils.help(parser.args, PLAYBOOK_FIELDS))
return marshal(playbooks, PLAYBOOK_FIELDS)