@app.route('/api/<codename>/<component>/<architecture>/<package>/<version>/')
@app.route('/api/<codename>/<component>/<architecture>/<package>/<version>/<format>')
def get_package_detail(codename, component, architecture, package, version, format=None):
    app.logger.info(request.path)

    g.breadcrumb = [{'name': 'browse', 'url': url_for('get_repository_detail')},
                    {'name': codename, 'url': url_for('get_codename_detail', codename=codename)},
                    {'name': component, 'url': url_for('get_component_detail', codename=codename, component=component)},
                    {'name': architecture, 'url': url_for('get_architecture_detail', codename=codename, component=component, architecture=architecture)},
                    {'name': package, 'url': url_for('get_package_versions', codename=codename, component=component, architecture=architecture, package=package)},
                    {'name': version, 'url': request.path},]

    # get any un-referenced versions of our package name
    repository = Repository(settings.basedir)
    all_versions = repository.list(codename, package)

    try:
        reference = cache(settings).read(repository, codename, component, architecture, package, version)
        app.logger.debug('Rendering from cache')
    except Exception as e:
        # loop through the references until we find a match. Cache it out afterwards
        # so that we don't have to do this again.
        app.logger.info(e)
        for ref in repository.dumpreferences():
            if ref['package'] == package and ref['version'] == version:
                ref['deb'] = os.path.join(repository.options.basedir, ref['deb'])

                try:
                    (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(ref['deb'])
                    ref['stats'] = {'mtime': time.ctime(mtime), 'ctime': time.ctime(ctime), 'user': pwd.getpwuid(uid).pw_gecos, 'size': size}
                except Exception as e:
                    app.logger.warn(e)

                try:
                    cache(settings).write(repository, codename, component, architecture, package, ref['version'], ref)
                    reference = ref
                except Exception as e:
                    # unable to cache result. reference local variable will not have been set.
                    app.logger.warn('unable to cache')
                    app.logger.warn(e)

    if 'reference' in locals():
        return render_template('api/detail/version.html', package=package, reference=reference, versions=all_versions)

    return render_template('api/detail/version.html', package=package)
dataset/ETHPy150Open baseblack/ReproWeb/reproweb/views.py/get_package_detail/original