[Doc] pdoc route documentation test

This commit is contained in:
Ferdinand Thiessen 2020-10-30 02:46:29 +01:00
parent 56fff76bc2
commit 4a7caad7e8
2 changed files with 16 additions and 13 deletions

View File

@ -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/<token> GET: get lifetime of token
/auth/<token> 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:

View File

@ -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.
"""