aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarko Tibold2011-12-30 16:35:22 +0100
committerMarko Tibold2011-12-30 16:35:22 +0100
commitb137b5ee5606a182dab4ff68a29f805b72e81ad3 (patch)
treeff272330f1e1c8924477768436a6d6b49444af4b
parent28f1b027aa8b452378a89118b938f24b2383dc9a (diff)
parentb8bfebc83719a7c286fee413bb44fffedac1a8d0 (diff)
downloaddjango-rest-framework-b137b5ee5606a182dab4ff68a29f805b72e81ad3.tar.bz2
Merge remote-tracking branch 'upstream/master'
-rw-r--r--djangorestframework/resources.py2
-rw-r--r--djangorestframework/tests/validators.py8
-rw-r--r--examples/epio.ini3
-rw-r--r--examples/objectstore/views.py3
-rw-r--r--examples/settings.py3
5 files changed, 12 insertions, 7 deletions
diff --git a/djangorestframework/resources.py b/djangorestframework/resources.py
index bf9af6f0..68b285b9 100644
--- a/djangorestframework/resources.py
+++ b/djangorestframework/resources.py
@@ -173,7 +173,7 @@ class FormResource(Resource):
field_errors[key] = [u'This field does not exist.']
if field_errors:
- detail[u'field-errors'] = field_errors
+ detail[u'field_errors'] = field_errors
# Return HTTP 400 response (BAD REQUEST)
raise ErrorResponse(400, detail)
diff --git a/djangorestframework/tests/validators.py b/djangorestframework/tests/validators.py
index 1f696422..18c8c313 100644
--- a/djangorestframework/tests/validators.py
+++ b/djangorestframework/tests/validators.py
@@ -149,7 +149,7 @@ class TestFormValidation(TestCase):
try:
validator.validate_request(content, None)
except ErrorResponse, exc:
- self.assertEqual(exc.response.raw_content, {'field-errors': {'qwerty': ['This field is required.']}})
+ self.assertEqual(exc.response.raw_content, {'field_errors': {'qwerty': ['This field is required.']}})
else:
self.fail('ResourceException was not raised') #pragma: no cover
@@ -159,7 +159,7 @@ class TestFormValidation(TestCase):
try:
validator.validate_request(content, None)
except ErrorResponse, exc:
- self.assertEqual(exc.response.raw_content, {'field-errors': {'qwerty': ['This field is required.']}})
+ self.assertEqual(exc.response.raw_content, {'field_errors': {'qwerty': ['This field is required.']}})
else:
self.fail('ResourceException was not raised') #pragma: no cover
@@ -169,7 +169,7 @@ class TestFormValidation(TestCase):
try:
validator.validate_request(content, None)
except ErrorResponse, exc:
- self.assertEqual(exc.response.raw_content, {'field-errors': {'extra': ['This field does not exist.']}})
+ self.assertEqual(exc.response.raw_content, {'field_errors': {'extra': ['This field does not exist.']}})
else:
self.fail('ResourceException was not raised') #pragma: no cover
@@ -179,7 +179,7 @@ class TestFormValidation(TestCase):
try:
validator.validate_request(content, None)
except ErrorResponse, exc:
- self.assertEqual(exc.response.raw_content, {'field-errors': {'qwerty': ['This field is required.'],
+ self.assertEqual(exc.response.raw_content, {'field_errors': {'qwerty': ['This field is required.'],
'extra': ['This field does not exist.']}})
else:
self.fail('ResourceException was not raised') #pragma: no cover
diff --git a/examples/epio.ini b/examples/epio.ini
index 00a90bce..4e61a42d 100644
--- a/examples/epio.ini
+++ b/examples/epio.ini
@@ -42,11 +42,12 @@ postgres = true
# to the real file 'configs/epio.py':
# config.py = configs/epio.py
+media/ = %(data_directory)s/
# #### If you're using Django, you'll want to uncomment some or all of these lines ####
# [django]
# # Path to your project root, relative to this directory.
-# base = .
+# base = .
#
# [static]
# Serve the admin media
diff --git a/examples/objectstore/views.py b/examples/objectstore/views.py
index 2a222529..8f997d7e 100644
--- a/examples/objectstore/views.py
+++ b/examples/objectstore/views.py
@@ -13,6 +13,9 @@ import operator
OBJECT_STORE_DIR = os.path.join(settings.MEDIA_ROOT, 'objectstore')
MAX_FILES = 10
+if not os.path.exists(OBJECT_STORE_DIR):
+ os.makedirs(OBJECT_STORE_DIR)
+
def remove_oldest_files(dir, max_files):
"""
diff --git a/examples/settings.py b/examples/settings.py
index 4438bb84..e12b7f3f 100644
--- a/examples/settings.py
+++ b/examples/settings.py
@@ -1,4 +1,5 @@
# Settings for djangorestframework examples project
+import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -46,7 +47,7 @@ USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/"
# NOTE: Some of the djangorestframework examples use MEDIA_ROOT to store content.
-MEDIA_ROOT = 'media/'
+MEDIA_ROOT = os.path.join(os.getenv('EPIO_DATA_DIRECTORY', '.'), 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).