aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/settings.py
diff options
context:
space:
mode:
authorTom Christie2012-09-16 14:02:18 -0700
committerTom Christie2012-09-16 14:02:18 -0700
commit549ebdc1c67c20bdff39a2f4a59012dd010213a1 (patch)
treeef7b3626e602ecaa1761cb4e780501f0b8db9463 /djangorestframework/settings.py
parentb7b8cd11b1aad3fcf4bad221d164bb55e0bf5859 (diff)
parentd8ede0355c32455989ca5f955d555ffaf827b296 (diff)
downloaddjango-rest-framework-549ebdc1c67c20bdff39a2f4a59012dd010213a1.tar.bz2
Merge pull request #263 from tomchristie/decouple-conneg
Content negotiation logic out of response and into View
Diffstat (limited to 'djangorestframework/settings.py')
-rw-r--r--djangorestframework/settings.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/djangorestframework/settings.py b/djangorestframework/settings.py
index e5181f4b..4dec1a4d 100644
--- a/djangorestframework/settings.py
+++ b/djangorestframework/settings.py
@@ -38,6 +38,7 @@ DEFAULTS = {
),
'DEFAULT_PERMISSIONS': (),
'DEFAULT_THROTTLES': (),
+ 'DEFAULT_CONTENT_NEGOTIATION': 'djangorestframework.negotiation.DefaultContentNegotiation',
'UNAUTHENTICATED_USER': 'django.contrib.auth.models.AnonymousUser',
'UNAUTHENTICATED_TOKEN': None,
@@ -46,6 +47,7 @@ DEFAULTS = {
'FORM_CONTENT_OVERRIDE': '_content',
'FORM_CONTENTTYPE_OVERRIDE': '_content_type',
'URL_ACCEPT_OVERRIDE': '_accept',
+ 'URL_FORMAT_OVERRIDE': 'format',
'FORMAT_SUFFIX_KWARG': 'format'
}
@@ -58,8 +60,9 @@ IMPORT_STRINGS = (
'DEFAULT_AUTHENTICATION',
'DEFAULT_PERMISSIONS',
'DEFAULT_THROTTLES',
+ 'DEFAULT_CONTENT_NEGOTIATION',
'UNAUTHENTICATED_USER',
- 'UNAUTHENTICATED_TOKEN'
+ 'UNAUTHENTICATED_TOKEN',
)
@@ -68,7 +71,7 @@ def perform_import(val, setting):
If the given setting is a string import notation,
then perform the necessary import or imports.
"""
- if val is None or setting not in IMPORT_STRINGS:
+ if val is None or not setting in IMPORT_STRINGS:
return val
if isinstance(val, basestring):
@@ -88,10 +91,7 @@ def import_from_string(val, setting):
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
module = importlib.import_module(module_path)
return getattr(module, class_name)
- except Exception, e:
- import traceback
- tb = traceback.format_exc()
- import pdb; pdb.set_trace()
+ except:
msg = "Could not import '%s' for API setting '%s'" % (val, setting)
raise ImportError(msg)