Skip to content

Commit

Permalink
Merge branch 'release/0.25.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ri-gilfanov committed Jul 15, 2021
2 parents b44e8c0 + 6059ec1 commit 5323385
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
4 changes: 1 addition & 3 deletions aiohttp_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
)
from aiohttp_sqlalchemy.views import (
SABaseView,
SAInstanceMixin,
SAItemAddMixin,
SAItemDeleteMixin,
SAItemEditMixin,
Expand All @@ -49,7 +48,7 @@
SAView,
)

__version__ = '0.24.0.post0'
__version__ = '0.25.0'

__all__ = [
'DEFAULT_KEY',
Expand All @@ -76,7 +75,6 @@
'SAListEditMixin',
'SAListViewMixin',

'SAInstanceMixin',
'SAItemMixin',
'SAMixin',
'SAModelView',
Expand Down
16 changes: 5 additions & 11 deletions aiohttp_sqlalchemy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aiohttp.web import View
from aiohttp_things.views import (
ContextMixin,
InstanceMixin,
ItemMixin,
ListMixin,
PrimaryKeyMixin,
)
Expand Down Expand Up @@ -50,12 +50,6 @@ def get_sa_select_stmt(self, model: Any = None) -> Select:
return select(model or self.sa_model)


class SAInstanceMixin(InstanceMixin, SAModelMixin, metaclass=ABCMeta):
"""
Instance mixin for adding, editing and viewing a single instance.
"""


class SAPrimaryKeyMixin(PrimaryKeyMixin, SAModelMixin, metaclass=ABCMeta):
"""
Primary key mixin for deleting, editing and viewing a single instance
Expand All @@ -70,9 +64,9 @@ class SAItemMixin(SAModelMixin, metaclass=ABCMeta):
pass


class SAItemAddMixin(SAItemMixin, SAInstanceMixin, metaclass=ABCMeta):
class SAItemAddMixin(SAItemMixin, ItemMixin, metaclass=ABCMeta):
def sa_add(self, *, key: Optional[str] = None) -> None:
self.sa_session(key).add(self.instance)
self.sa_session(key).add(self.item)


class SAItemDeleteMixin(
Expand All @@ -89,7 +83,7 @@ def get_sa_delete_stmt(self, model: Any = None) -> Delete:

class SAItemEditMixin(
SAItemMixin,
SAInstanceMixin,
ItemMixin,
SAModelEditMixin,
SAPrimaryKeyMixin,
metaclass=ABCMeta,
Expand All @@ -102,7 +96,7 @@ def get_sa_edit_stmt(self, model: Any = None) -> Update:

class SAItemViewMixin(
SAItemMixin,
SAInstanceMixin,
ItemMixin,
SAModelViewMixin,
SAPrimaryKeyMixin,
metaclass=ABCMeta,
Expand Down
5 changes: 0 additions & 5 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ Class based views

Instance mixins
^^^^^^^^^^^^^^^
.. autoclass:: aiohttp_sqlalchemy.SAInstanceMixin
:inherited-members:
:members:
:show-inheritance:

.. autoclass:: aiohttp_sqlalchemy.SAPrimaryKeyMixin
:inherited-members:
:members:
Expand Down
13 changes: 13 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
========
Releases
========
Version 0.25
------------
**Changed**

* Attribute ``instance`` renamed to ``item`` in ``SAItemAddMixin``,
``SAItemEditMixin``, ``SAItemViewMixin``.

**Removed**

* ``SAInstanceMixin`` removed, use ``SAItemMixin``.

Version 0.24
------------
**Removed**

* ``SAInstanceView`` class;
* ``SAItemView`` synonym for ``SAInstanceView``;
* ``SAAbstractView`` synonym for ``SAMixin``;
Expand All @@ -16,6 +28,7 @@ Version 0.24
Version 0.23
------------
**Add**

* ``SAItemMixin`` as a separate mixin;
* ``SAInstanceAddMixin`` as a synonym for ``SAItemAddMixin``;
* ``SAInstanceDeleteMixin`` as a synonym for ``SAItemDeleteMixin``;
Expand Down
8 changes: 3 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aiohttp-sqlalchemy"
version = "0.24.0.post0"
version = "0.25.0"
description = "SQLAlchemy 1.4 / 2.0 support for aiohttp."
authors = [
"Ruslan Ilyasovich Gilfanov <ri.gilfanov@yandex.ru>",
Expand Down Expand Up @@ -34,7 +34,7 @@ repository = "https://github.com/ri-gilfanov/aiohttp-sqlalchemy"
[tool.poetry.dependencies]
python = "^3.7"
aiohttp = "^3.7.4.post0"
aiohttp-things = ">=0.7.0"
aiohttp-things = ">=0.8.0"
SQLAlchemy = "^1.4.21"
aiomysql = { version = ">=0.0.21", optional = true }
aiosqlite = { version = ">=0.17.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class InstanceAdd(web.View, SAItemAddMixin):

mocked_request[SA_DEFAULT_KEY] = session
view = InstanceAdd(mocked_request)
view.instance = Model()
view.item = Model()
view.sa_add()


Expand Down

0 comments on commit 5323385

Please sign in to comment.