aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorTom Christie2012-11-09 05:07:34 -0800
committerTom Christie2012-11-09 05:07:34 -0800
commitc7df9694b5a7a7931161f74a7c5c16d5c98d87d9 (patch)
treed2f832ad883a51ce2bde6b1d44b0156f300612c3 /rest_framework/compat.py
parent0089f0faa716bd37ca29f9f2db98b4ab273e01f1 (diff)
parentff1234b711b8dfb7dc1cc539fa9d2b6fd2477825 (diff)
downloaddjango-rest-framework-c7df9694b5a7a7931161f74a7c5c16d5c98d87d9.tar.bz2
Merge pull request #383 from tomchristie/filtering
Support for filtering backends
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