Exemplo n.º 1
0
    def reload_status(self, package_id):
        """Return the status of the current package reload.

        This is a JSON map. If the reload is finished, it will contain only a
        'done' key with value true. If the reload is in progress, it will
        contain 'count' and 'total' keys, indicating the total number of
        packages to reload and the number that have been reloaded so far,
        respectively.
        """
        if not users.is_current_user_admin(): cherrypy.http_error(403)
        cherrypy.response.headers['Content-Type'] = 'application/json'
        reload_status = PackageVersion.get_reload_status()
        return json.dumps(reload_status or {'done': True})
Exemplo n.º 2
0
    def reload_status(self, package_id, format):
        """Return the status of the current package reload.

        This is a JSON map. If the reload is finished, it will contain only a
        'done' key with value true. If the reload is in progress, it will
        contain 'count' and 'total' keys, indicating the total number of
        packages to reload and the number that have been reloaded so far,
        respectively.
        """
        if not users.is_current_user_admin():
            handlers.http_error(403, "Permission denied.")
        reload_status = PackageVersion.get_reload_status()
        return json.dumps(reload_status or {'done': True})
Exemplo n.º 3
0
    def reload_status(self, format):
        """Return the status of the current package reload.

        This is a JSON map. If the reload is finished, it will contain only a
        'done' key with value true. If the reload is in progress, it will
        contain 'count' and 'total' keys, indicating the total number of
        packages to reload and the number that have been reloaded so far,
        respectively.
        """
        if not users.is_current_user_admin():
            handlers.http_error(403, "Permission denied.")
        reload_status = PackageVersion.get_reload_status()
        return json.dumps(reload_status or {'done': True})
Exemplo n.º 4
0
    def admin(self):
        """Retrieve a page for performing administrative tasks."""

        if not users.get_current_user():
            raise cherrypy.HTTPRedirect(users.create_login_url(cherrypy.url()))
        elif not users.is_current_user_admin():
            raise handlers.http_error(403)

        reload_status = PackageVersion.get_reload_status()
        if reload_status is not None:
            reload_status['percentage'] = '%d%%' % (
                100.0 * reload_status['count'] / reload_status['total'])

        return handlers.render('admin',
               reload_status=reload_status,
               private_keys_set=PrivateKey.get_oauth() is not None,
               production=handlers.is_production(),
               layout={'title': 'Admin Console'})
Exemplo n.º 5
0
    def admin(self):
        """Retrieve a page for performing administrative tasks."""

        if not users.get_current_user():
            raise cherrypy.HTTPRedirect(users.create_login_url(cherrypy.url()))
        elif not users.is_current_user_admin():
            raise handlers.http_error(403)

        reload_status = PackageVersion.get_reload_status()
        if reload_status is not None:
            reload_status['percentage'] = '%d%%' % (
                100.0 * reload_status['count'] / reload_status['total'])

        return handlers.render('admin',
               reload_status=reload_status,
               private_keys_set=PrivateKey.get_oauth() is not None,
               production=handlers.is_production(),
               layout={'title': 'Admin Console'})
Exemplo n.º 6
0
    def admin(self):
        """Retrieve a page for performing administrative tasks."""

        if not users.get_current_user():
            raise cherrypy.HTTPRedirect(users.create_login_url(cherrypy.url()))
        elif not users.is_current_user_admin():
            raise handlers.http_error(403)

        reload_status = PackageVersion.get_reload_status()
        if reload_status is not None:
            reload_status["percentage"] = "%d%%" % (100.0 * reload_status["count"] / reload_status["total"])

        return handlers.render(
            "admin",
            reload_status=reload_status,
            private_key_set=PrivateKey.get() is not None,
            production=handlers.is_production(),
            layout={"title": "Admin Console"},
        )