Skip to content

Commit

Permalink
Removed DeprecationWarning for get_cache function
Browse files Browse the repository at this point in the history
  • Loading branch information
ellmetha committed Apr 13, 2015
1 parent 44b1c7c commit 3a5c870
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion machina/apps/forum_conversation/forum_attachments/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# Third party imports
from django.conf import settings
from django.core.cache import get_cache
from django.core.cache import InvalidCacheBackendError
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import InMemoryUploadedFile
Expand All @@ -15,6 +14,7 @@

# Local application / specific library imports
from machina.conf import settings as machina_settings
from machina.core.compat import get_cache


class AttachmentCache(object):
Expand Down
11 changes: 11 additions & 0 deletions machina/core/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Standard library imports
# Third party imports
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
Expand Down Expand Up @@ -48,3 +49,13 @@
except ImportError: # pragma: no cover
from django.contrib.auth.models import User
get_user_model = lambda: User


# get_cache
if DJANGO_VERSION >= (1, 7):
from django.core.cache import caches

def get_cache(key):
return caches[key]
else: # pragma: no cover
from django.core.cache import get_cache # noqa

0 comments on commit 3a5c870

Please sign in to comment.