def api_v1_changes(device='all', before=-1): version = get_device_version(device) if version: versions = [version] else: versions = [] response_changes = [] try: changes, last = get_changes(gerrit, device, before, versions) for change in changes: response_changes.append({ 'project': change.project, 'subject': change.subject, 'submitted': get_timestamp(change.submitted), 'updated': get_timestamp(change.updated), 'url': change.url, 'owner': change.owner, 'labels': change.labels }) except ConnectionError: last = 0 response_changes.append({ 'project': None, 'subject': None, 'submitted': 0, 'updated': 0, 'url': Config.STATUS_URL, 'owner': None, 'labels': None }) return jsonify({ 'last': last, 'res': response_changes, })
def changes(device='all', before=-1): return jsonify( get_changes(gerrit, device, before, get_device_version(device), app.config.get('STATUS_URL', '#')))
def changes(device='all', before=-1): if device == 'all': device = None return jsonify(get_changes(gerrit, device, before))