mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Add BaseTildesSchema with context dict
Add BaseTildesSchema with context dict
To replace the context field removed in Marshmallow 4.0merge-requests/171/head
14 changed files with 66 additions and 51 deletions
-
5tildes/tests/test_markdown_field.py
-
5tildes/tests/test_simplestring_field.py
-
3tildes/tildes/resources/group.py
-
22tildes/tildes/schemas/base.py
-
7tildes/tildes/schemas/comment.py
-
7tildes/tildes/schemas/group.py
-
5tildes/tildes/schemas/group_wiki_page.py
-
5tildes/tildes/schemas/listing.py
-
6tildes/tildes/schemas/message.py
-
5tildes/tildes/schemas/topic.py
-
13tildes/tildes/schemas/user.py
-
23tildes/tildes/views/decorators.py
-
5tildes/tildes/views/login.py
-
6tildes/tildes/views/register.py
@ -0,0 +1,22 @@ |
|||||
|
# Copyright (c) 2018 Tildes contributors <code@tildes.net> |
||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later |
||||
|
|
||||
|
"""Base Marshmallow schema.""" |
||||
|
|
||||
|
|
||||
|
from typing import Any |
||||
|
from marshmallow import Schema |
||||
|
from tildes.schemas.context import TildesSchemaContextDict |
||||
|
|
||||
|
|
||||
|
class BaseTildesSchema(Schema): |
||||
|
"""Base Marshmallow schema for Tildes schemas. |
||||
|
|
||||
|
Adds common code like the context dict. |
||||
|
""" |
||||
|
|
||||
|
context: TildesSchemaContextDict |
||||
|
|
||||
|
def __init__(self, context: TildesSchemaContextDict = {}, **kwargs: Any): |
||||
|
super().__init__(**kwargs) |
||||
|
self.context = context |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue