From 2597265c49d662b0735c961176a8a4db92520fa2 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 18 Aug 2023 07:31:11 +0200 Subject: [PATCH] flask: be clearer that overwrites are only for testing ref: https://github.com/hynek/svcs/discussions/8#discussioncomment-6748481 --- docs/integrations/flask.md | 16 +++++++++++++++- src/svcs/flask.py | 2 -- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/integrations/flask.md b/docs/integrations/flask.md index f73cab7..6eea371 100644 --- a/docs/integrations/flask.md +++ b/docs/integrations/flask.md @@ -203,11 +203,25 @@ def index(): ``` -### Registering and Overwriting Services +### Registering Services ```{eval-rst} .. autofunction:: register_factory .. autofunction:: register_value +``` + + +### Testing + +:::{caution} +This functions should not be used in production code. + +They always reset the container and run all cleanups after overwriting a service. + +See also {ref}`flask-testing`. +::: + +```{eval-rst} .. autofunction:: overwrite_factory .. autofunction:: overwrite_value ``` diff --git a/src/svcs/flask.py b/src/svcs/flask.py index cb09101..074d108 100644 --- a/src/svcs/flask.py +++ b/src/svcs/flask.py @@ -131,7 +131,6 @@ def overwrite_factory( .. seealso:: - :meth:`svcs.Registry.register_factory()` - :meth:`svcs.Container.close()` - - :ref:`flask-testing` """ container = svcs_from() container.registry.register_factory( @@ -161,7 +160,6 @@ def overwrite_value( .. seealso:: - :meth:`svcs.Registry.register_factory()` - :meth:`svcs.Container.close()` - - :ref:`flask-testing` """ container = svcs_from() container.registry.register_value(