diff --git a/README.rst b/README.rst index dda0fb05..56a45cdf 100644 --- a/README.rst +++ b/README.rst @@ -134,16 +134,16 @@ several IoC containers for some example application: class Services(containers.DeclarativeContainer): """IoC container of business service providers.""" - users = providers.Factory(example.services.Users, + users = providers.Factory(example.services.UsersService, logger=Platform.logger, db=Platform.database) - auth = providers.Factory(example.services.Auth, + auth = providers.Factory(example.services.AuthService, logger=Platform.logger, db=Platform.database, token_ttl=3600) - photos = providers.Factory(example.services.Photos, + photos = providers.Factory(example.services.PhotosService, logger=Platform.logger, db=Platform.database, s3=Platform.s3) @@ -185,17 +185,18 @@ Next example demonstrates run of example application defined above: # s3 = boto.s3.connection.S3Connection(aws_access_key_id='KEY', # aws_secret_access_key='SECRET') # - # example.main.main(uid=sys.argv[1], - # password=sys.argv[2], - # photo=sys.argv[3], - # users_service=example.services.Users(logger=logger, - # db=database), - # auth_service=example.services.Auth(logger=logger, - # db=database, - # token_ttl=3600), - # photos_service=example.services.Photos(logger=logger, - # db=database, - # s3=s3)) + # example.main.main( + # uid=sys.argv[1], + # password=sys.argv[2], + # photo=sys.argv[3], + # users_service=example.services.UsersService(logger=logger, + # db=database), + # auth_service=example.services.AuthService(logger=logger, + # db=database, + # token_ttl=3600), + # photos_service=example.services.PhotosService(logger=logger, + # db=database, + # s3=s3)) Alternative definition styles of providers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 92f32d9c..3a9e6304 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -11,6 +11,7 @@ Development version ------------------- .. - No features. - Add github badges to readme and docs index pages. +- Update service names in services example miniapp. 2.2.8 ----- diff --git a/examples/miniapps/services/containers.py b/examples/miniapps/services/containers.py index e859e248..4beb12cd 100644 --- a/examples/miniapps/services/containers.py +++ b/examples/miniapps/services/containers.py @@ -27,16 +27,16 @@ class Platform(containers.DeclarativeContainer): class Services(containers.DeclarativeContainer): """IoC container of business service providers.""" - users = providers.Factory(example.services.Users, + users = providers.Factory(example.services.UsersService, logger=Platform.logger, db=Platform.database) - auth = providers.Factory(example.services.Auth, + auth = providers.Factory(example.services.AuthService, logger=Platform.logger, db=Platform.database, token_ttl=3600) - photos = providers.Factory(example.services.Photos, + photos = providers.Factory(example.services.PhotosService, logger=Platform.logger, db=Platform.database, s3=Platform.s3) diff --git a/examples/miniapps/services/containers_alt_syntax_1.py b/examples/miniapps/services/containers_alt_syntax_1.py index bf7389d0..5910bda7 100644 --- a/examples/miniapps/services/containers_alt_syntax_1.py +++ b/examples/miniapps/services/containers_alt_syntax_1.py @@ -32,16 +32,16 @@ class Platform(containers.DeclarativeContainer): class Services(containers.DeclarativeContainer): """IoC container of business service providers.""" - users = providers.Factory(example.services.Users) \ + users = providers.Factory(example.services.UsersService) \ .add_kwargs(logger=Platform.logger, db=Platform.database) - auth = providers.Factory(example.services.Auth) \ + auth = providers.Factory(example.services.AuthService) \ .add_kwargs(logger=Platform.logger, db=Platform.database, token_ttl=3600) - photos = providers.Factory(example.services.Photos) \ + photos = providers.Factory(example.services.PhotosService) \ .add_kwargs(logger=Platform.logger, db=Platform.database, s3=Platform.s3) diff --git a/examples/miniapps/services/containers_alt_syntax_2.py b/examples/miniapps/services/containers_alt_syntax_2.py index 1388c298..cf332672 100644 --- a/examples/miniapps/services/containers_alt_syntax_2.py +++ b/examples/miniapps/services/containers_alt_syntax_2.py @@ -32,16 +32,16 @@ class Platform(containers.DeclarativeContainer): class Services(containers.DeclarativeContainer): """IoC container of business service providers.""" - users = providers.Factory(example.services.Users) + users = providers.Factory(example.services.UsersService) users.add_kwargs(logger=Platform.logger, db=Platform.database) - auth = providers.Factory(example.services.Auth) + auth = providers.Factory(example.services.AuthService) auth.add_kwargs(logger=Platform.logger, db=Platform.database, token_ttl=3600) - photos = providers.Factory(example.services.Photos) + photos = providers.Factory(example.services.PhotosService) photos.add_kwargs(logger=Platform.logger, db=Platform.database, s3=Platform.s3) diff --git a/examples/miniapps/services/example/services.py b/examples/miniapps/services/example/services.py index 171f2506..e907c1ca 100644 --- a/examples/miniapps/services/example/services.py +++ b/examples/miniapps/services/example/services.py @@ -1,7 +1,7 @@ """Example business services module.""" -class Users(object): +class UsersService(object): """Users service.""" def __init__(self, logger, db): @@ -16,7 +16,7 @@ class Users(object): 'password_hash': 'secret_hash'} -class Auth(object): +class AuthService(object): """Auth service.""" def __init__(self, logger, db, token_ttl): @@ -32,7 +32,7 @@ class Auth(object): user['uid']) -class Photos(object): +class PhotosService(object): """Photos service.""" def __init__(self, logger, db, s3): diff --git a/examples/miniapps/services/run.py b/examples/miniapps/services/run.py index cb001336..e416f5b8 100644 --- a/examples/miniapps/services/run.py +++ b/examples/miniapps/services/run.py @@ -22,14 +22,15 @@ if __name__ == '__main__': # s3 = boto.s3.connection.S3Connection(aws_access_key_id='KEY', # aws_secret_access_key='SECRET') # - # example.main.main(uid=sys.argv[1], - # password=sys.argv[2], - # photo=sys.argv[3], - # users_service=example.services.Users(logger=logger, - # db=database), - # auth_service=example.services.Auth(logger=logger, - # db=database, - # token_ttl=3600), - # photos_service=example.services.Photos(logger=logger, - # db=database, - # s3=s3)) + # example.main.main( + # uid=sys.argv[1], + # password=sys.argv[2], + # photo=sys.argv[3], + # users_service=example.services.UsersService(logger=logger, + # db=database), + # auth_service=example.services.AuthService(logger=logger, + # db=database, + # token_ttl=3600), + # photos_service=example.services.PhotosService(logger=logger, + # db=database, + # s3=s3))