From 7206b4dbb89ab38f09e478ea35d007749824638b Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 27 May 2016 14:38:42 +0300 Subject: [PATCH] Update services example with new containers --- .../miniapps/services/{catalogs.py => containers.py} | 10 +++++----- ...logs_alt_syntax_1.py => containers_alt_syntax_1.py} | 10 +++++----- ...logs_alt_syntax_2.py => containers_alt_syntax_2.py} | 10 +++++----- examples/miniapps/services/main.py | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) rename examples/miniapps/services/{catalogs.py => containers.py} (77%) rename examples/miniapps/services/{catalogs_alt_syntax_1.py => containers_alt_syntax_1.py} (77%) rename examples/miniapps/services/{catalogs_alt_syntax_2.py => containers_alt_syntax_2.py} (77%) diff --git a/examples/miniapps/services/catalogs.py b/examples/miniapps/services/containers.py similarity index 77% rename from examples/miniapps/services/catalogs.py rename to examples/miniapps/services/containers.py index 37a5bdf7..31391ee1 100644 --- a/examples/miniapps/services/catalogs.py +++ b/examples/miniapps/services/containers.py @@ -4,12 +4,12 @@ import sqlite3 import boto.s3.connection import example.services -from dependency_injector import catalogs +from dependency_injector import containers from dependency_injector import providers -class Platform(catalogs.DeclarativeCatalog): - """Catalog of platform service providers.""" +class Platform(containers.DeclarativeContainer): + """Container of platform service providers.""" database = providers.Singleton(sqlite3.connect, ':memory:') @@ -18,8 +18,8 @@ class Platform(catalogs.DeclarativeCatalog): aws_secret_access_key='SECRET') -class Services(catalogs.DeclarativeCatalog): - """Catalog of business service providers.""" +class Services(containers.DeclarativeContainer): + """Container of business service providers.""" users = providers.Factory(example.services.Users, db=Platform.database) diff --git a/examples/miniapps/services/catalogs_alt_syntax_1.py b/examples/miniapps/services/containers_alt_syntax_1.py similarity index 77% rename from examples/miniapps/services/catalogs_alt_syntax_1.py rename to examples/miniapps/services/containers_alt_syntax_1.py index 7f2c615f..441a9785 100644 --- a/examples/miniapps/services/catalogs_alt_syntax_1.py +++ b/examples/miniapps/services/containers_alt_syntax_1.py @@ -7,12 +7,12 @@ import sqlite3 import boto.s3.connection import example.services -from dependency_injector import catalogs +from dependency_injector import containers from dependency_injector import providers -class Platform(catalogs.DeclarativeCatalog): - """Catalog of platform service providers.""" +class Platform(containers.DeclarativeContainer): + """Container of platform service providers.""" database = providers.Singleton(sqlite3.connect) \ .add_args(':memory:') @@ -22,8 +22,8 @@ class Platform(catalogs.DeclarativeCatalog): aws_secret_access_key='SECRET') -class Services(catalogs.DeclarativeCatalog): - """Catalog of business service providers.""" +class Services(containers.DeclarativeContainer): + """Container of business service providers.""" users = providers.Factory(example.services.Users) \ .add_kwargs(db=Platform.database) diff --git a/examples/miniapps/services/catalogs_alt_syntax_2.py b/examples/miniapps/services/containers_alt_syntax_2.py similarity index 77% rename from examples/miniapps/services/catalogs_alt_syntax_2.py rename to examples/miniapps/services/containers_alt_syntax_2.py index 0f3c245d..2e2d783b 100644 --- a/examples/miniapps/services/catalogs_alt_syntax_2.py +++ b/examples/miniapps/services/containers_alt_syntax_2.py @@ -7,12 +7,12 @@ import sqlite3 import boto.s3.connection import example.services -from dependency_injector import catalogs +from dependency_injector import containers from dependency_injector import providers -class Platform(catalogs.DeclarativeCatalog): - """Catalog of platform service providers.""" +class Platform(containers.DeclarativeContainer): + """Container of platform service providers.""" database = providers.Singleton(sqlite3.connect) database.add_args(':memory:') @@ -22,8 +22,8 @@ class Platform(catalogs.DeclarativeCatalog): aws_secret_access_key='SECRET') -class Services(catalogs.DeclarativeCatalog): - """Catalog of business service providers.""" +class Services(containers.DeclarativeContainer): + """Container of business service providers.""" users = providers.Factory(example.services.Users) users.add_kwargs(db=Platform.database) diff --git a/examples/miniapps/services/main.py b/examples/miniapps/services/main.py index 9398c8b3..b6c5c864 100644 --- a/examples/miniapps/services/main.py +++ b/examples/miniapps/services/main.py @@ -2,7 +2,7 @@ from dependency_injector.injections import inject -from catalogs import Services +from containers import Services @inject(users_service=Services.users)