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
6af75d3a
Commit
6af75d3a
authored
Sep 04, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some bits from utils
parent
6e219159
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
36 deletions
+5
-36
djangorestframework/response.py
+5
-2
djangorestframework/utils/__init__.py
+0
-33
djangorestframework/utils/breadcrumbs.py
+0
-1
No files found.
djangorestframework/response.py
View file @
6af75d3a
...
@@ -11,15 +11,18 @@ by specifying an ``_accept=`` parameter in the URL. Also, `Response` will ignore
...
@@ -11,15 +11,18 @@ by specifying an ``_accept=`` parameter in the URL. Also, `Response` will ignore
from Internet Explorer user agents and use a sensible browser `Accept` header instead.
from Internet Explorer user agents and use a sensible browser `Accept` header instead.
"""
"""
import
re
from
django.template.response
import
SimpleTemplateResponse
from
django.template.response
import
SimpleTemplateResponse
from
django.core.handlers.wsgi
import
STATUS_CODE_TEXT
from
django.core.handlers.wsgi
import
STATUS_CODE_TEXT
from
djangorestframework.settings
import
api_settings
from
djangorestframework.settings
import
api_settings
from
djangorestframework.utils.mediatypes
import
order_by_precedence
from
djangorestframework.utils.mediatypes
import
order_by_precedence
from
djangorestframework.utils
import
MSIE_USER_AGENT_REGEX
from
djangorestframework
import
status
from
djangorestframework
import
status
MSIE_USER_AGENT_REGEX
=
re
.
compile
(
r'^Mozilla/[0-9]+\.[0-9]+ \([^)]*; MSIE [0-9]+\.[0-9]+[a-z]?;[^)]*\)(?!.* Opera )'
)
class
NotAcceptable
(
Exception
):
class
NotAcceptable
(
Exception
):
pass
pass
...
...
djangorestframework/utils/__init__.py
View file @
6af75d3a
from
django.utils.encoding
import
smart_unicode
from
django.utils.encoding
import
smart_unicode
from
django.utils.xmlutils
import
SimplerXMLGenerator
from
django.utils.xmlutils
import
SimplerXMLGenerator
from
django.core.urlresolvers
import
resolve
from
djangorestframework.compat
import
StringIO
from
djangorestframework.compat
import
StringIO
from
djangorestframework.compat
import
RequestFactory
as
DjangoRequestFactory
from
djangorestframework.compat
import
RequestFactory
as
DjangoRequestFactory
...
@@ -9,38 +8,6 @@ from djangorestframework.request import Request
...
@@ -9,38 +8,6 @@ from djangorestframework.request import Request
import
re
import
re
import
xml.etree.ElementTree
as
ET
import
xml.etree.ElementTree
as
ET
MSIE_USER_AGENT_REGEX
=
re
.
compile
(
r'^Mozilla/[0-9]+\.[0-9]+ \([^)]*; MSIE [0-9]+\.[0-9]+[a-z]?;[^)]*\)(?!.* Opera )'
)
def
as_tuple
(
obj
):
"""
Given an object which may be a list/tuple, another object, or None,
return that object in list form.
IE:
If the object is already a list/tuple just return it.
If the object is not None, return it in a list with a single element.
If the object is None return an empty list.
"""
if
obj
is
None
:
return
()
elif
isinstance
(
obj
,
list
):
return
tuple
(
obj
)
elif
isinstance
(
obj
,
tuple
):
return
obj
return
(
obj
,)
def
url_resolves
(
url
):
"""
Return True if the given URL is mapped to a view in the urlconf, False otherwise.
"""
try
:
resolve
(
url
)
except
Exception
:
return
False
return
True
# From xml2dict
# From xml2dict
class
XML2Dict
(
object
):
class
XML2Dict
(
object
):
...
...
djangorestframework/utils/breadcrumbs.py
View file @
6af75d3a
...
@@ -30,4 +30,3 @@ def get_breadcrumbs(url):
...
@@ -30,4 +30,3 @@ def get_breadcrumbs(url):
return
breadcrumbs_recursive
(
url
[:
url
.
rfind
(
'/'
)
+
1
],
breadcrumbs_list
)
return
breadcrumbs_recursive
(
url
[:
url
.
rfind
(
'/'
)
+
1
],
breadcrumbs_list
)
return
breadcrumbs_recursive
(
url
,
[])
return
breadcrumbs_recursive
(
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