From 4a7caad7e810ddb2c4d32a1cb582195fa598cf0d Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 30 Oct 2020 02:46:29 +0100 Subject: [PATCH] [Doc] pdoc route documentation test --- flaschengeist/modules/auth/__init__.py | 16 ++++++++-------- flaschengeist/system/models/__init__.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/flaschengeist/modules/auth/__init__.py b/flaschengeist/modules/auth/__init__.py index 5c279b3..d50223a 100644 --- a/flaschengeist/modules/auth/__init__.py +++ b/flaschengeist/modules/auth/__init__.py @@ -1,14 +1,13 @@ -"""Flaschengeist plugin: Auth +"""Authentication plugin, provides basic routes Allow management of authentication, login, logout, etc. - Routes - - /auth POST: login (new token) + ```Routes + /auth POST: login (new token) GET: get all tokens for user - /auth/ GET: get lifetime of token + /auth/ GET: get lifetime of token PUT: set new lifetime - DELETE: logout / delete token + DELETE: logout / delete token``` """ from flask import Blueprint, request, jsonify @@ -17,7 +16,7 @@ from werkzeug.exceptions import Forbidden, BadRequest, Unauthorized from flaschengeist import logger from flaschengeist.modules import Plugin from flaschengeist.system.decorator import login_required -from flaschengeist.system.controller import sessionController, userController, messageController +from flaschengeist.system.controller import sessionController, userController auth_bp = Blueprint("auth", __name__) @@ -31,7 +30,8 @@ class AuthRoutePlugin(Plugin): def _login(): """Login in an user and create a `flaschengeist.system.models.Session` for the user. - Route: /auth + Route: ``/auth`` + POST-data: {'userid': string, 'password': string} Returns: diff --git a/flaschengeist/system/models/__init__.py b/flaschengeist/system/models/__init__.py index 595a52e..016672a 100644 --- a/flaschengeist/system/models/__init__.py +++ b/flaschengeist/system/models/__init__.py @@ -4,6 +4,8 @@ from sqlalchemy.types import DateTime, TypeDecorator class ModelSerializeMixin: def serialize(self): + """Return: + Dict of all not private or protected annotated member variables.""" d = {param: getattr(self, param) for param in self.__class__.__annotations__ if not param.startswith("_")} if len(d) == 1: key, value = d.popitem() @@ -12,14 +14,15 @@ class ModelSerializeMixin: class UtcDateTime(TypeDecorator): - """Almost equivalent to :class:`~sqlalchemy.types.DateTime` with + """Almost equivalent to `sqlalchemy.types.DateTime` with ``timezone=True`` option, but it differs from that by: - - Never silently take naive :class:`~datetime.datetime`, instead it + + - Never silently take naive :class:`datetime.datetime`, instead it always raise :exc:`ValueError` unless time zone aware value. - - :class:`~datetime.datetime` value's :attr:`~datetime.datetime.tzinfo` + - :class:`datetime.datetime` value's :attr:`datetime.datetime.tzinfo` is always converted to UTC. - - Unlike SQLAlchemy's built-in :class:`~sqlalchemy.types.DateTime`, - it never return naive :class:`~datetime.datetime`, but time zone + - Unlike SQLAlchemy's built-in :class:`sqlalchemy.types.DateTime`, + it never return naive :class:`datetime.datetime`, but time zone aware value, even with SQLite or MySQL. """