`ValidationErrorMessage` is a string-like object that holds a code
attribute.
The code attribute has been removed from ValidationError to be able
to maintain better backward compatibility.
What this means is that `ValidationError` can accept either a regular
string or a `ValidationErrorMessage` for its `detail` attribute.
We should keep `Serializer.errors`'s return type unchanged in
order to maintain backward compatibility.
The error codes will only be propagated to the `exception_handler`
or accessible through the `Serializer._errors` private attribute.
This patch is meant to fix#3111, regarding comments made to #3137
and #3169.
The `ValidationError` will now contain a `code` attribute.
Before this patch, `ValidationError.detail` only contained a
`dict` with values equal to a `list` of string error messages or
directly a `list` containing string error messages.
Now, the string error messages are replaced with `ValidationError`.
This means that, depending on the case, you will not only get a
string back but a all object containing both the error message and
the error code, respectively `ValidationError.detail` and
`ValidationError.code`.
It is important to note that the `code` attribute is not relevant
when the `ValidationError` represents a combination of errors and
hence is `None` in such cases.
The main benefit of this change is that the error message and
error code are now accessible the custom exception handler and can
be used to format the error response.
An custom exception handler example is available in the
`TestValidationErrorWithCode` test.
This allows users in Django 1.9+ to include the authentication urls
without specifying the namespace, as in:
urlpatterns = [
...
url(r'^auth/', include('rest_framework.urls'))
]
Quietly catching `AttributeError` and `TypeError` when calling
`get_queryset()` is rather insidious, as those exceptions get caught no
matter where they might happen in the call stack.
If a NestedBoundField field has a value of `None` and is inside another NestedBoundField field, it will have its value converted to an empty string while the form of its enclosing field is being rendered. So, NestedBoundField fields with an empty string value must be handled the same way as NestedBoundField fields with a `None` value.
Windows Pythons seem to like printing addresses in upper-case, while Linux
Pythons like lower-case hexes.
This led to an amusing (for a given value of "amusing", anyway) situation
where some repr tests would fail if the objects they were testing happened
to be allocated at an address with a hex digit in the range A..F.
This gets rid of a file encoding bug that occurs on Windows boxes where
the default implied encoding is cp1252, but the files themselves aren't.
The actual patch that seems to fix this is
1057d5e12e
but it seems like a good idea to upgrade to the latest and greatest.
Version 0.11b3's setup.py had an undeclared dependency on `py2exe` when
running on Windows (see
https://github.com/transifex/transifex-client/blob/0.11b3/setup.py#L23),
which made it impossible to install without having a working `py2exe` to
begin with.
This has been fixed in 0.11 proper.