drakken.exceptions module

Drakken exception classes and functions.

exception drakken.exceptions.AccountDisabled

Bases: Exception

Account disabled: user.active = False.

exception drakken.exceptions.AuthenticateFail

Bases: Exception

Email/password failure.

exception drakken.exceptions.BadRequest

Bases: Exception

400 Bad request.

exception drakken.exceptions.CSRFTokenFail

Bases: Exception

CSRF token failure.

exception drakken.exceptions.EmailAddressTaken

Bases: Exception

Email address already taken.

exception drakken.exceptions.Forbidden

Bases: Exception

403 Forbidden request.

Yes, we understood your request, and no, we’re not going to do it.

exception drakken.exceptions.HTTPRedirect(path, status_code=302)

Bases: Exception

HTTP Redirect (302).

Parameters:
  • path (str) – path redirected to.

  • status_code (int) – response status code. Default is 302.

exception drakken.exceptions.LoginFail

Bases: Exception

Bad session ID.

exception drakken.exceptions.NotFound

Bases: Exception

404 File not found.

To supply a 404 page, put a file named 404.html in the top-level templates folder.

exception drakken.exceptions.PasswordLength

Bases: Exception

Password too long or too short.

exception drakken.exceptions.UserNameTaken

Bases: Exception

User name already taken.

drakken.exceptions.redirect(path, status_code=302)

Friendly wrapper to raise HTTPRedirect exception.

Allows you to redirect() instead of raise HTTPRedirect().

Parameters:
  • path (str) – path redirected to.

  • status_code (int) – response status code. Default is 302.

Raises:

HTTPRedirect – redirect to another URL.