def get_project_info(project): matches = _database().get_versions(project) if not matches: projects = _database().name_search(project) if project not in projects: return jsonstatus.error(404, 'No such project') return jsonstatus.ok(versions=[]) versions = [{'branch': i[0], 'revision': i[1]} for i in matches] return jsonstatus.ok(versions=versions)
def get_project_info(project): metadata = _database().get_metadata(project) matches = _database().get_versions(project) if not matches: projects = _database().name_search(project) if project not in projects: return jsonstatus.error(404, 'No such project') return jsonstatus.ok(versions=[]) md = dict() if metadata is not None: for field in ['homepage', 'description']: if metadata.has(field): md[field] = getattr(metadata, field) versions = [{'branch': i[0], 'revision': i[1]} for i in matches] return jsonstatus.ok(name=project, metadata=md, versions=versions)
def get_project_info(project): if project is None: return get_projectlist() matches = _database().get_versions(project) if len(matches) == 0: return jsonstatus.error(500, 'No such project') versions = [{'branch': i[0], 'revision': i[1]} for i in matches] return jsonstatus.ok(versions=versions)
def get_project_info(project): if project is None: return get_projectlist() matches = _database().get_versions(project) if len(matches) == 0: return jsonstatus.error(404, 'No such project') versions = [{'branch': i[0], 'revision': i[1]} for i in matches] return jsonstatus.ok(versions=versions)
def update_project(project, repo_url, branch): if branch == 'master': return jsonstatus.error(406, 'Will not update master branch') # FIXME, should launch in the background instead. This will now block # until branching is finished. try: _wrapupdater().update_db(project, repo_url, branch) return jsonstatus.ok() except Exception as e: return jsonstatus.error(500, 'Wrap generation failed. %s' % e)
def get_latest(project): matches = _database().get_versions(project, latest=True) if len(matches) == 0: return jsonstatus.error(500, 'No such project') latest = matches[0] return jsonstatus.ok(branch=latest[0], revision=latest[1])
def name_query(project): return jsonstatus.ok(projects=_database().name_search(project))
def get_projectlist(): return jsonstatus.ok(projects=_database().name_search(''))
def get_latest(project): matches = _database().get_versions(project, latest=True) if len(matches) == 0: return jsonstatus.error(404, 'No such project') latest = matches[0] return jsonstatus.ok(branch=latest[0], revision=latest[1])
def name_query(project): return jsonstatus.ok(projects=_database().name_search(project))
def get_projectlist(): return jsonstatus.ok(projects=_database().name_search(''))
def get_latest(project): latest = _database().get_latest_version(project) if latest is None: return jsonstatus.error(404, 'No such project') return jsonstatus.ok(branch=latest[0], revision=latest[1])