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
3f91379e
Commit
3f91379e
authored
Apr 10, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 1.3 compat issue. Closes #780
parent
c2280e34
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
rest_framework/compat.py
+5
-1
No files found.
rest_framework/compat.py
View file @
3f91379e
...
...
@@ -400,12 +400,16 @@ except ImportError:
try
:
from
django.utils.html
import
smart_urlquote
except
ImportError
:
import
re
from
django.utils.encoding
import
smart_str
try
:
from
urllib.parse
import
quote
,
urlsplit
,
urlunsplit
except
ImportError
:
# Python 2
from
urllib
import
quote
from
urlparse
import
urlsplit
,
urlunsplit
unquoted_percents_re
=
re
.
compile
(
r'
%
(?![0-9A-Fa-f]{2})'
)
def
smart_urlquote
(
url
):
"Quotes a URL if it isn't already quoted."
# Handle IDN before quoting.
...
...
@@ -421,7 +425,7 @@ except ImportError:
# contains a % not followed by two hexadecimal digits. See #9655.
if
'
%
'
not
in
url
or
unquoted_percents_re
.
search
(
url
):
# See http://bugs.python.org/issue2637
url
=
quote
(
force_bytes
(
url
),
safe
=
b
'!*
\'
();:@&=+$,/?#[]~'
)
url
=
quote
(
smart_str
(
url
),
safe
=
b
'!*
\'
();:@&=+$,/?#[]~'
)
return
force_text
(
url
)
...
...
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