This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #845 from cfpb/regcore-with-python
Pull from regulations-core with Python, not HTTP
- Loading branch information
Showing
4 changed files
with
152 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from django.conf.urls import url | ||
from django.http import Http404, HttpResponseNotFound, JsonResponse | ||
|
||
|
||
def returns200(request): | ||
return JsonResponse({'foo': 'bar'}) | ||
|
||
|
||
def returnsGet(request): | ||
return JsonResponse(request.GET) | ||
|
||
|
||
def returns404(request): | ||
return HttpResponseNotFound('not found') | ||
|
||
|
||
def raisesHttp404(request): | ||
raise Http404('not found') | ||
|
||
|
||
def raisesException(request): | ||
raise RuntimeError('something bad happened') | ||
|
||
|
||
urlpatterns = [ | ||
url('returns-200', returns200), | ||
url('returns-get', returnsGet), | ||
url('returns-404', returns404), | ||
url('raises-http404', raisesHttp404), | ||
url('raises-exception', raisesException), | ||
] |