Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
b137b5ee
Commit
b137b5ee
authored
Dec 30, 2011
by
Marko Tibold
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
28f1b027
b8bfebc8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
7 deletions
+12
-7
djangorestframework/resources.py
+1
-1
djangorestframework/tests/validators.py
+4
-4
examples/epio.ini
+2
-1
examples/objectstore/views.py
+3
-0
examples/settings.py
+2
-1
No files found.
djangorestframework/resources.py
View file @
b137b5ee
...
...
@@ -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
)
...
...
djangorestframework/tests/validators.py
View file @
b137b5ee
...
...
@@ -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
...
...
examples/epio.ini
View file @
b137b5ee
...
...
@@ -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
...
...
examples/objectstore/views.py
View file @
b137b5ee
...
...
@@ -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
):
"""
...
...
examples/settings.py
View file @
b137b5ee
# 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).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment