Skip to content

Commit

Permalink
Merge pull request #199 from WinterFramework/fix-domain-event-dispatcher
Browse files Browse the repository at this point in the history
Fix domain event dispatcher
  • Loading branch information
pristupa authored Jun 1, 2021
2 parents c8a4b51 + 89adab4 commit eba0553
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [9.2.0] - 2021-06-01

### Bugfixes
- get_injector() is called lazily

## [9.1.0] - 2021-06-01

### Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion winter/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '9.1.0'
__version__ = '9.2.0'
3 changes: 1 addition & 2 deletions winter_django/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ class WinterView(rest_framework.views.APIView):

def _create_dispatch_function(controller_class, route: Route):
component = get_component(controller_class)
injector = get_injector()

@wraps(route.method.func)
def dispatch(winter_view, request: Request, **path_variables):
controller = injector.get(component.component_cls)
controller = get_injector().get(component.component_cls)
return _call_controller_method(controller, route, request)

return dispatch
Expand Down
3 changes: 1 addition & 2 deletions winter_sqlalchemy/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@


def sqla_crud(repository_cls):
injector = get_injector()

if not issubclass(repository_cls, CRUDRepository):
raise TypeError('Repository must be inherited from CRUDRepository before annotating with sqla_crud')

Expand Down Expand Up @@ -168,6 +166,7 @@ def __init__(self, engine: Engine):
class RepositoryImpl(DefaultCRUDRepositoryImpl, *repository_subclasses):
@inject
def __init__(self):
injector = get_injector()
injector.call_with_injection(DefaultCRUDRepositoryImpl.__init__, self)
for subclass in repository_subclasses:
injector.call_with_injection(subclass.__init__, self)
Expand Down

0 comments on commit eba0553

Please sign in to comment.