Re: Feature Idea for overwrite_default_connection context manager

2022-06-01 Thread Alexander Lyabah
That's a great idea, actually. Thank you On Wednesday, June 1, 2022 at 4:56:31 PM UTC+3 Adam Johnson wrote: > Modifying the connections object seems like the wrong way to approach > this, as it's not intended for mutation. Did you consider writing a > database router and then having a context m

Re: Feature Idea for overwrite_default_connection context manager

2022-06-01 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Modifying the connections object seems like the wrong way to approach this, as it's not intended for mutation. Did you consider writing a database router and then having a context manager that affects the router's state? https://docs.djangoproject.com/en/4.0/topics/db/multi-db/#topics-db-multi-db-r

Feature Idea for overwrite_default_connection context manager

2022-06-01 Thread Alexander Lyabah
In some of the previous version on Django I had a very useful context manager. from contextlib import ContextDecorator from django.db import connections class overwrite_default_connection(ContextDecorator): prev_default = None write_connection = None def __init__(self, write_con

Django bugfix release: 4.0.5

2022-06-01 Thread Carlton Gibson
Details are available on the Django project weblog: https://www.djangoproject.com/weblog/2022/jun/01/bugfix-release/ -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop

Re: get_random_secret_key not documented!?

2022-06-01 Thread epokeins
Thank you. I thought every function should be documented and nobody realized that this one is not. But if that's not the case maybe one should at least point out to the Python best practice which your just mentioned Adam. I didn't know that recipe one so far. But shouldn't almost everyone cre

Re: get_random_secret_key not documented!?

2022-06-01 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Python's secrets module has token_hex and a short recipe for generating random strings: https://docs.python.org/3.10/library/secrets.html#recipes-and-best-practices . I don't think Django needs to provide a public function here. I would advise Digital Ocean to recommend the secrets module. On Wed,

Re: get_random_secret_key not documented!?

2022-06-01 Thread Fab
There isn't a recommended way so you can generate it however you want. The function is used in the startproject command for convenience. On Monday, 16 May 2022 a