Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to get many values (only getting all values) #521

Closed
gabriels1234 opened this issue May 5, 2023 · 2 comments
Closed

No way to get many values (only getting all values) #521

gabriels1234 opened this issue May 5, 2023 · 2 comments

Comments

@gabriels1234
Copy link

Describe the problem

For a Constance setup that has many many values, and to optimize for speed, get_values() is more expensive than it could be.

def get_values():  # <-- No arguments, gets all the values
    """
    Get dictionary of values from the backend
    :return:
    """

    # First load a mapping between config name and default value
    default_initial = ((name, options[0])
                       for name, options in settings.CONFIG.items())
    # Then update the mapping with actually values from the backend
    initial = dict(default_initial, **dict(config._backend.mget(settings.CONFIG)))

    return initial

I was wondering if there's interest in modifying this function to allow for optionally specifying which values to get. I could make a PR for it. (cc/ @syre )
Thanks!

@Mogost
Copy link
Member

Mogost commented Sep 10, 2024

PR is always welcome!

Isn't this a duplicate of #344 ?

@camilonova
Copy link
Member

It will add extra complexity for an uncommon use case. Even if we get a PR, it isn't the right fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants