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
aa95ccba
Commit
aa95ccba
authored
Feb 22, 2013
by
Michael Elovskikh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed UnicodeDecodeError on get_name and get_description methods
parent
ef3303eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
rest_framework/renderers.py
+3
-2
rest_framework/views.py
+3
-2
No files found.
rest_framework/renderers.py
View file @
aa95ccba
...
@@ -14,6 +14,7 @@ import json
...
@@ -14,6 +14,7 @@ import json
from
django
import
forms
from
django
import
forms
from
django.http.multipartparser
import
parse_header
from
django.http.multipartparser
import
parse_header
from
django.template
import
RequestContext
,
loader
,
Template
from
django.template
import
RequestContext
,
loader
,
Template
from
django.utils.encoding
import
force_unicode
from
rest_framework.compat
import
yaml
from
rest_framework.compat
import
yaml
from
rest_framework.exceptions
import
ConfigurationError
from
rest_framework.exceptions
import
ConfigurationError
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
...
@@ -405,13 +406,13 @@ class BrowsableAPIRenderer(BaseRenderer):
...
@@ -405,13 +406,13 @@ class BrowsableAPIRenderer(BaseRenderer):
try
:
try
:
return
view
.
get_name
()
return
view
.
get_name
()
except
AttributeError
:
except
AttributeError
:
return
view
.
__doc__
return
force_unicode
(
view
.
__doc__
)
def
get_description
(
self
,
view
):
def
get_description
(
self
,
view
):
try
:
try
:
return
view
.
get_description
(
html
=
True
)
return
view
.
get_description
(
html
=
True
)
except
AttributeError
:
except
AttributeError
:
return
view
.
__doc__
return
force_unicode
(
view
.
__doc__
)
def
render
(
self
,
data
,
accepted_media_type
=
None
,
renderer_context
=
None
):
def
render
(
self
,
data
,
accepted_media_type
=
None
,
renderer_context
=
None
):
"""
"""
...
...
rest_framework/views.py
View file @
aa95ccba
...
@@ -4,6 +4,7 @@ Provides an APIView class that is used as the base of all class-based views.
...
@@ -4,6 +4,7 @@ Provides an APIView class that is used as the base of all class-based views.
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
Http404
from
django.http
import
Http404
from
django.utils.encoding
import
force_unicode
from
django.utils.html
import
escape
from
django.utils.html
import
escape
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.views.decorators.csrf
import
csrf_exempt
from
django.views.decorators.csrf
import
csrf_exempt
...
@@ -96,7 +97,7 @@ class APIView(View):
...
@@ -96,7 +97,7 @@ class APIView(View):
Override to customize.
Override to customize.
"""
"""
# TODO: deprecate?
# TODO: deprecate?
name
=
self
.
__class__
.
__name__
name
=
force_unicode
(
self
.
__class__
.
__name__
)
name
=
_remove_trailing_string
(
name
,
'View'
)
name
=
_remove_trailing_string
(
name
,
'View'
)
return
_camelcase_to_spaces
(
name
)
return
_camelcase_to_spaces
(
name
)
...
@@ -106,7 +107,7 @@ class APIView(View):
...
@@ -106,7 +107,7 @@ class APIView(View):
Override to customize.
Override to customize.
"""
"""
# TODO: deprecate?
# TODO: deprecate?
description
=
self
.
__doc__
or
''
description
=
force_unicode
(
self
.
__doc__
)
or
u
''
description
=
_remove_leading_indent
(
description
)
description
=
_remove_leading_indent
(
description
)
if
html
:
if
html
:
return
self
.
markup_description
(
description
)
return
self
.
markup_description
(
description
)
...
...
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