Browse Source

fixing documentation

still don't like ReST
master
Holger Frey 7 years ago
parent
commit
85a99b1d6a
  1. 22
      ordr2/models/account.py
  2. 4
      ordr2/resources/base.py
  3. 2
      ordr2/security.py
  4. 1
      ordr2/session.py

22
ordr2/models/account.py

@ -85,7 +85,7 @@ class User(Base): @@ -85,7 +85,7 @@ class User(Base):
username = Column(Text, nullable=False, unique=True)
#: hashed password, see :mod:`ordr2.security`
password_hash = Column(Text, nullable=False)
#: role of the user, see :class:`ordr2.models.users.Role`
#: role of the user, see :class:`ordr2.models.account.Role`
role = Column(Enum(Role), nullable=False)
first_name = Column(Text, nullable=False)
@ -159,8 +159,8 @@ class User(Base): @@ -159,8 +159,8 @@ class User(Base):
what the token is used for
:type subject:
ordr2.models.account.TokenSubject
:param **payload:
etra data to store with the token, must be JSON serializable
:param payload:
extra data to store with the token, must be JSON serializable
:rtype:
(str) unique hash to access the token
'''
@ -176,11 +176,23 @@ class Token(Base): @@ -176,11 +176,23 @@ class Token(Base):
''' Tokens for mail change, account verification and password reset '''
__tablename__ = 'tokens'
#: hash identifyer of the token
hash = Column(Unicode, primary_key=True)
#: :class:`ordr2.models.account.TokenSubject`
subject = Column(Enum(TokenSubject), nullable=False)
#: token expires at this date and time
expires = Column(DateTime, nullable=False)
#: additional data to attach to a token
payload = Column(JsonEncoder, nullable=False)
#: the user_id the token belongs to
owner_id = Column(Integer, ForeignKey('users.id'))
#: the user the token belongs to
owner = relationship('User', back_populates='tokens')
@classmethod
@ -207,8 +219,8 @@ class Token(Base): @@ -207,8 +219,8 @@ class Token(Base):
account the token is issued for
:type subject:
ordr2.models.account.User
:param **payload:
etra data to store with the token, must be JSON serializable
:param payload:
extra data to store with the token, must be JSON serializable
:rtype:
ordr2.models.account.Token
'''

4
ordr2/resources/base.py

@ -52,7 +52,9 @@ class BaseResource(object): @@ -52,7 +52,9 @@ class BaseResource(object):
:param str key:
path segment for a child resource
:rtype:
ordr2.resources.BaseResource or KeyError
subclass of ordr2.resources.base.BaseResource
:raises:
KeyError if path segment is not found
'''
node_class = self.nodes[key]
return node_class(key, self)

2
ordr2/security.py

@ -38,7 +38,7 @@ def get_user(request): @@ -38,7 +38,7 @@ def get_user(request):
:type request:
pyramid.request.Request
:rtype:
ordr2.models.users.User or None
:class:`ordr2.models.account.User` or None
'''
user_id = request.unauthenticated_userid
if user_id is not None:

1
ordr2/session.py

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
''' Session configuration '''
import binascii
from pyramid.session import BaseCookieSessionFactory
from pyramid_nacl_session import EncryptedCookieSessionFactory