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

support lower case options #87

Closed
oppianmatt opened this issue Jun 21, 2016 · 2 comments
Closed

support lower case options #87

oppianmatt opened this issue Jun 21, 2016 · 2 comments

Comments

@oppianmatt
Copy link

Some backends use lowercase options. For example https://github.com/django-pylibmc/django-pylibmc

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': 'localhost:11211',
        'TIMEOUT': 500,
        'BINARY': True,
        'OPTIONS': {  # Maps to pylibmc "behaviors"
            'tcp_nodelay': True,
            'ketama': True
        }
    }
}

So I create a protocol on the fly like so in settings:

environ.Env.CACHE_SCHEMES['django-pylibmc'] = 'django_pylibmc.memcached.PyLibMCCache'

and set my environment like so:

CACHE_URL=django-pylibmc://memcached:11211?tcp_nodelay=1&ketama=1

But it get's converted to uppercase like so:

opt = {k.upper(): _cast_int(v[0])}
@joke2k
Copy link
Owner

joke2k commented Jul 7, 2017

Actually we cannot skip the use of upper() for keys.
Most of third-party plugin uses upper-cased characters.

See #139 if you are interested to extend django-environ to solve your issue.

@sergeyklay
Copy link
Collaborator

I want to close this issue because I don't want a bunch of these lying around. I'd like to add support for anything/everything at some point, but keeping the issue open doesn't help that. :) The issue #139 explains the acceptable way to handle such use cases. If anyone wants to get started, I'd love that.

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