Commit b137b5ee by Marko Tibold

Merge remote-tracking branch 'upstream/master'

parents 28f1b027 b8bfebc8
...@@ -173,7 +173,7 @@ class FormResource(Resource): ...@@ -173,7 +173,7 @@ class FormResource(Resource):
field_errors[key] = [u'This field does not exist.'] field_errors[key] = [u'This field does not exist.']
if field_errors: if field_errors:
detail[u'field-errors'] = field_errors detail[u'field_errors'] = field_errors
# Return HTTP 400 response (BAD REQUEST) # Return HTTP 400 response (BAD REQUEST)
raise ErrorResponse(400, detail) raise ErrorResponse(400, detail)
......
...@@ -149,7 +149,7 @@ class TestFormValidation(TestCase): ...@@ -149,7 +149,7 @@ class TestFormValidation(TestCase):
try: try:
validator.validate_request(content, None) validator.validate_request(content, None)
except ErrorResponse, exc: 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: else:
self.fail('ResourceException was not raised') #pragma: no cover self.fail('ResourceException was not raised') #pragma: no cover
...@@ -159,7 +159,7 @@ class TestFormValidation(TestCase): ...@@ -159,7 +159,7 @@ class TestFormValidation(TestCase):
try: try:
validator.validate_request(content, None) validator.validate_request(content, None)
except ErrorResponse, exc: 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: else:
self.fail('ResourceException was not raised') #pragma: no cover self.fail('ResourceException was not raised') #pragma: no cover
...@@ -169,7 +169,7 @@ class TestFormValidation(TestCase): ...@@ -169,7 +169,7 @@ class TestFormValidation(TestCase):
try: try:
validator.validate_request(content, None) validator.validate_request(content, None)
except ErrorResponse, exc: 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: else:
self.fail('ResourceException was not raised') #pragma: no cover self.fail('ResourceException was not raised') #pragma: no cover
...@@ -179,7 +179,7 @@ class TestFormValidation(TestCase): ...@@ -179,7 +179,7 @@ class TestFormValidation(TestCase):
try: try:
validator.validate_request(content, None) validator.validate_request(content, None)
except ErrorResponse, exc: 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.']}}) 'extra': ['This field does not exist.']}})
else: else:
self.fail('ResourceException was not raised') #pragma: no cover self.fail('ResourceException was not raised') #pragma: no cover
......
...@@ -42,11 +42,12 @@ postgres = true ...@@ -42,11 +42,12 @@ postgres = true
# to the real file 'configs/epio.py': # to the real file 'configs/epio.py':
# config.py = 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 #### # #### If you're using Django, you'll want to uncomment some or all of these lines ####
# [django] # [django]
# # Path to your project root, relative to this directory. # # Path to your project root, relative to this directory.
# base = . # base = .
# #
# [static] # [static]
# Serve the admin media # Serve the admin media
......
...@@ -13,6 +13,9 @@ import operator ...@@ -13,6 +13,9 @@ import operator
OBJECT_STORE_DIR = os.path.join(settings.MEDIA_ROOT, 'objectstore') OBJECT_STORE_DIR = os.path.join(settings.MEDIA_ROOT, 'objectstore')
MAX_FILES = 10 MAX_FILES = 10
if not os.path.exists(OBJECT_STORE_DIR):
os.makedirs(OBJECT_STORE_DIR)
def remove_oldest_files(dir, max_files): def remove_oldest_files(dir, max_files):
""" """
......
# Settings for djangorestframework examples project # Settings for djangorestframework examples project
import os
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
...@@ -46,7 +47,7 @@ USE_L10N = True ...@@ -46,7 +47,7 @@ USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/" # Example: "/home/media/media.lawrence.com/"
# NOTE: Some of the djangorestframework examples use MEDIA_ROOT to store content. # 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 # 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). # trailing slash if there is a path component (optional in other cases).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment