Skip to content

Commit

Permalink
flask: be clearer that overwrites are only for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Aug 18, 2023
1 parent ba3d0b3 commit 2597265
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 15 additions & 1 deletion docs/integrations/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
2 changes: 0 additions & 2 deletions src/svcs/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 2597265

Please sign in to comment.