How to use the py4web.redirect function in py4web

To help you get started, we’ve selected a few py4web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web2py / py4web / py4web / utils / auth.py View on Github external
data = self.update_profile(user, **vars)
                else:
                    data = {"status": "error", "message": "undefined"}
            if not "status" in data and data.get("errors"):
                data.update(status="error", message="validation errors", code=401)
            elif "errors" in data and not data["errors"]:
                del data["errors"]
            data["status"] = data.get("status", "success")
            data["code"] = data.get("code", 200)
            return data
        elif path == "logout":
            self.session["user"] = None
            # Somehow call revoke for active plugin
        elif path == "verify_email" and self.db:
            if self.verify_email(get_vars.get("token")):
                redirect(URL("auth", "email_verified"))
            else:
                redirect(URL("auth", "token_expired"))
        env["path"] = path
        return Template("auth.html").transform(env)
github web2py / py4web / py4web / utils / auth.py View on Github external
def abort_or_rediect(self, page):
        """
        return HTTP 403 if content_type is applicaitons/json
        else redirects to page"""
        if request.content_type == "application/json":
            abort(403)
        redirect(URL(self.auth.route, page))
github web2py / py4web / py4web / utils / auth.py View on Github external
data = {"status": "error", "message": "undefined"}
            if not "status" in data and data.get("errors"):
                data.update(status="error", message="validation errors", code=401)
            elif "errors" in data and not data["errors"]:
                del data["errors"]
            data["status"] = data.get("status", "success")
            data["code"] = data.get("code", 200)
            return data
        elif path == "logout":
            self.session["user"] = None
            # Somehow call revoke for active plugin
        elif path == "verify_email" and self.db:
            if self.verify_email(get_vars.get("token")):
                redirect(URL("auth", "email_verified"))
            else:
                redirect(URL("auth", "token_expired"))
        env["path"] = path
        return Template("auth.html").transform(env)
github web2py / py4web / apps / _documentation / __init__.py View on Github external
def index():
    redirect(URL('static/index.html'))