def __init__(self, package_name: str, request: Request):
        super().__init__(request)

        self.package_name = package_name
        self.package = package_service.get_package_by_id(package_name)
        self.latest_release = package_service.get_latest_release_for_package(package_name)
        self.latest_version = "0.0.0"
        self.is_latest = True
        self.maintainers = []

        if not self.package or not self.latest_release:
            return

        self.latest_version = self.latest_release.version
        self.maintainers = self.package.maintainers
    def __init__(self, package_name: str):
        super().__init__()
        self.package_name = package_name
        self.package = None
        if package_name:
            self.package_name = package_name.strip().lower()
            self.package = package_service.get_package_by_id(self.package_name)

        self.latest_version = "0.0.0"
        self.latest_release = None
        self.is_latest = True

        if self.package and self.package.releases:
            self.latest_release = self.package.releases[0]
            self.latest_version = self.latest_release.version_text

        self.release_version = self.latest_release
Esempio n. 3
0
def package_details(package_name: str):
    if not package_name:
        return flask.abort(status=404)
    # test_packages = package_service.get_latest_packages()
    package = package_service.get_package_by_id(package_name)
    if not package:
        return flask.abort(status=404)

    latest_version = "0.0.0"
    latest_release = None
    is_latest = True

    if package.releases:
        latest_release = package.releases[0]
        latest_version = latest_release.version_text

    return flask.render_template('packages/details.html', package=package,
                                 latest_version=latest_version,
                                 latest_release=latest_release,
                                 release_version=latest_release,
                                 is_latest=is_latest)
Esempio n. 4
0
def package_details(package_name: str):
    if not package_name:
        return flask.abort(status=404)

    package = package_service.get_package_by_id(package_name.strip())
    if not package:
        return flask.abort(status=404)

    latest_version = "0.0.0"
    latest_release = None
    is_latest = True

    if package.releases:
        latest_release = package.releases[0]
        latest_version = latest_release.version_text

    return {
        'package': package,
        'latest_version': latest_version,
        'latest_release': latest_release,
        'release_version': latest_release,
        'is_latest': is_latest,
    }
def package_details(package_name: str):
    if not package_name:
        return flask.abort(status=404)

    package = package_service.get_package_by_id(package_name.strip().lower())
    if not package:
        return flask.abort(status=404)

    latest_version = "0.0.0"
    latest_release = None
    is_latest = True

    if package.releases:
        latest_release = package.releases[0]
        latest_version = latest_release.version_text

    return {
        'package': package,
        'latest_version': latest_version,
        'latest_release': latest_release,
        'release_version': latest_release,
        'is_latest': True,
        'user_id': cookie_auth.get_user_id_via_auth_cookie(flask.request),
    }