Skip to content

Commit

Permalink
Remove ConfigurationError in favor of Django's ImproperlyConfigured
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Jun 5, 2013
1 parent 2ca243a commit f8a0d31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions rest_framework/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,3 @@ def __init__(self, wait=None, detail=None):
self.detail = format % (self.wait, self.wait != 1 and 's' or '')
else:
self.detail = detail or self.default_detail


class ConfigurationError(Exception):
"""
Indicates an internal server error.
"""
pass
2 changes: 1 addition & 1 deletion rest_framework/generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def get_object(self, queryset=None):
)
filter_kwargs = {self.slug_field: slug}
else:
raise exceptions.ConfigurationError(
raise ImproperlyConfigured(
'Expected view %s to be called with a URL keyword argument '
'named "%s". Fix your URL conf, or set the `.lookup_field` '
'attribute on the view correctly.' %
Expand Down
4 changes: 2 additions & 2 deletions rest_framework/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import copy
import json
from django import forms
from django.core.exceptions import ImproperlyConfigured
from django.http.multipartparser import parse_header
from django.template import RequestContext, loader, Template
from django.utils.xmlutils import SimplerXMLGenerator
from rest_framework.compat import StringIO
from rest_framework.compat import six
from rest_framework.compat import smart_text
from rest_framework.compat import yaml
from rest_framework.exceptions import ConfigurationError
from rest_framework.settings import api_settings
from rest_framework.request import clone_request
from rest_framework.utils import encoders
Expand Down Expand Up @@ -270,7 +270,7 @@ def get_template_names(self, response, view):
return [self.template_name]
elif hasattr(view, 'get_template_names'):
return view.get_template_names()
raise ConfigurationError('Returned a template response with no template_name')
raise ImproperlyConfigured('Returned a template response with no template_name')

def get_exception_template(self, response):
template_names = [name % {'status_code': response.status_code}
Expand Down
6 changes: 3 additions & 3 deletions rest_framework/throttling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import unicode_literals
from django.core.cache import cache
from rest_framework import exceptions
from django.core.exceptions import ImproperlyConfigured
from rest_framework.settings import api_settings
import time

Expand Down Expand Up @@ -65,13 +65,13 @@ def get_rate(self):
if not getattr(self, 'scope', None):
msg = ("You must set either `.scope` or `.rate` for '%s' throttle" %
self.__class__.__name__)
raise exceptions.ConfigurationError(msg)
raise ImproperlyConfigured(msg)

try:
return self.settings.DEFAULT_THROTTLE_RATES[self.scope]
except KeyError:
msg = "No default throttle rate set for '%s' scope" % self.scope
raise exceptions.ConfigurationError(msg)
raise ImproperlyConfigured(msg)

def parse_rate(self, rate):
"""
Expand Down

0 comments on commit f8a0d31

Please sign in to comment.