Skip to content

Commit

Permalink
fix RemovedInDjango19Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Jul 27, 2015
1 parent 74105e1 commit c53e0c7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions spirit/core/tests/tests_utils_ratelimit.py
Expand Up @@ -8,7 +8,7 @@
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.messages.storage.fallback import FallbackStorage
from django.conf import settings
from django.core.cache import get_cache
from django.core.cache import caches

from ..utils.ratelimit import RateLimit
from ..utils.ratelimit.decorators import ratelimit
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_rate_limit_hash_key(self):
req.user = User()
req.user.pk = 1
RateLimit(req, 'func_name')
rl_cache = get_cache(settings.ST_RATELIMIT_CACHE)
rl_cache = caches[settings.ST_RATELIMIT_CACHE]
self.assertIsNotNone(rl_cache.get('srl:02b3cee0bd2a40ec0fca9b1bef06fb560a081673'))

def test_rate_limit_unique_key(self):
Expand All @@ -147,5 +147,5 @@ def one(request):
key = '%s:%s' % (settings.ST_RATELIMIT_CACHE_PREFIX, key_hash)

one(req)
rl_cache = get_cache(settings.ST_RATELIMIT_CACHE)
rl_cache = caches[settings.ST_RATELIMIT_CACHE]
self.assertIsNotNone(rl_cache.get(key))
4 changes: 2 additions & 2 deletions spirit/core/utils/ratelimit/ratelimit.py
Expand Up @@ -5,7 +5,7 @@
import hashlib

from django.conf import settings
from django.core.cache import get_cache
from django.core.cache import caches


TIME_DICT = {
Expand Down Expand Up @@ -68,7 +68,7 @@ def _incr_cache(self):
if not self.cache_keys:
return {}

cache = get_cache(settings.ST_RATELIMIT_CACHE)
cache = caches[settings.ST_RATELIMIT_CACHE]
cache_values = cache.get_many(self.cache_keys)

for key in self.cache_keys:
Expand Down
2 changes: 0 additions & 2 deletions spirit/topic/poll/forms.py
Expand Up @@ -115,12 +115,10 @@ def __init__(self, user=None, poll=None, *args, **kwargs):

if poll.is_multiple_choice:
self.fields['choices'] = forms.ModelMultipleChoiceField(queryset=choices,
cache_choices=True,
widget=forms.CheckboxSelectMultiple,
label=_("Poll choices"))
else:
self.fields['choices'] = forms.ModelChoiceField(queryset=choices,
cache_choices=True,
widget=forms.RadioSelect,
label=_("Poll choices"),
empty_label=None)
Expand Down
2 changes: 1 addition & 1 deletion spirit/user/utils/email.py
Expand Up @@ -5,7 +5,7 @@
import logging

from django.core.mail import EmailMessage
from django.contrib.sites.models import get_current_site
from django.contrib.sites.shortcuts import get_current_site
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string

Expand Down

0 comments on commit c53e0c7

Please sign in to comment.