diff --git a/djangorestframework/authentication.py b/djangorestframework/authentication.py index 656c58e4b..48f898dd5 100644 --- a/djangorestframework/authentication.py +++ b/djangorestframework/authentication.py @@ -79,9 +79,9 @@ class BasicAuthentication(BaseAuthentication): return None try: - username = encoding.smart_unicode(auth_parts[0]) - password = encoding.smart_unicode(auth_parts[2]) - except encoding.DjangoUnicodeDecodeError: + username = smart_unicode(auth_parts[0]) + password = smart_unicode(auth_parts[2]) + except DjangoUnicodeDecodeError: return None user = authenticate(username=username, password=password) diff --git a/djangorestframework/resources.py b/djangorestframework/resources.py index 30d75eef9..66ab0a855 100644 --- a/djangorestframework/resources.py +++ b/djangorestframework/resources.py @@ -126,8 +126,6 @@ class FormResource(Resource): data = data and data or {} files = files and files or {} - # In addition to regular validation we also ensure no additional fields - # are being passed in... seen_fields_set = set(data.keys()) form_fields_set = set(bound_form.fields.keys()) allowed_extra_fields_set = set(allowed_extra_fields) @@ -142,7 +140,7 @@ class FormResource(Resource): cleaned_data = bound_form.cleaned_data # Add in any extra fields to the cleaned content... - for key in (allowed_extra_fields & seen_fields) - set(cleaned_data.keys()): + for key in (allowed_extra_fields_set & seen_fields_set) - set(cleaned_data.keys()): cleaned_data[key] = data[key] return cleaned_data diff --git a/djangorestframework/tests/renderers.py b/djangorestframework/tests/renderers.py index b683e27d3..c3dfb98b6 100644 --- a/djangorestframework/tests/renderers.py +++ b/djangorestframework/tests/renderers.py @@ -157,7 +157,7 @@ class RendererIntegrationTests(TestCase): _flat_repr = '{"foo": ["bar", "baz"]}' -_indented_repr = '{\n "foo": [\n "bar", \n "baz"\n ]\n}' +_indented_repr = '{\n "foo": [\n "bar",\n "baz"\n ]\n}' class JSONRendererTests(TestCase):