aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2012-11-07 21:07:24 +0000
committerTom Christie2012-11-07 21:07:24 +0000
commit47b534a13e42d498629bf9522225633122c563d5 (patch)
treefc7acddb14038fc5f159c1399dac7974a76caf4b /rest_framework/compat.py
parent9fd061a0b68f0cef6683bf195911a2cc7ff2fa06 (diff)
downloaddjango-rest-framework-47b534a13e42d498629bf9522225633122c563d5.tar.bz2
Make filtering optional, and pluggable.
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py34
1 files changed, 7 insertions, 27 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index b0367a32..02e50604 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -5,6 +5,13 @@ versions of django/python, and compatbility wrappers around optional packages.
# flake8: noqa
import django
+# django-filter is optional
+try:
+ import django_filters
+except:
+ django_filters = None
+
+
# cStringIO only if it's available, otherwise StringIO
try:
import cStringIO as StringIO
@@ -348,33 +355,6 @@ except ImportError:
yaml = None
-import unittest
-try:
- import unittest.skip
-except ImportError: # python < 2.7
- from unittest import TestCase
- import functools
-
- def skip(reason):
- # Pasted from py27/lib/unittest/case.py
- """
- Unconditionally skip a test.
- """
- def decorator(test_item):
- if not (isinstance(test_item, type) and issubclass(test_item, TestCase)):
- @functools.wraps(test_item)
- def skip_wrapper(*args, **kwargs):
- pass
- test_item = skip_wrapper
-
- test_item.__unittest_skip__ = True
- test_item.__unittest_skip_why__ = reason
- return test_item
- return decorator
-
- unittest.skip = skip
-
-
# xml.etree.parse only throws ParseError for python >= 2.7
try:
from xml.etree import ParseError as ETParseError