예제 #1
0
 def test_dispatches_api_dispatch_accept_not_json(self):
     self.request.method = 'GET'
     self.request.META = {
         'HTTP_ACCEPT': 'text/html'
     }
     d = api_dispatch(
         GET=self.view
     )
     response = d(self.request)
     self.assertEqual(response, 'base_view')
예제 #2
0
 def test_dispatches_api_dispatch_accept_not_json(self):
     self.request.method = 'GET'
     self.request.META = {
         'HTTP_ACCEPT': 'text/html'
     }
     d = api_dispatch(
         GET=self.view
     )
     response = d(self.request)
     self.assertEqual(response, 'base_view')
예제 #3
0
파일: urls.py 프로젝트: kelp404/Salmon
# error handlers
handler403 = permission_denied
handler404 = page_not_found
handler500 = server_error


# routers
urlpatterns = patterns('',
    url(r'^$', dispatch(GET=base_view)),
    url(r'^login$', dispatch(GET=base_view)),


    # /projects/<project_id>
    url(r'^projects/(?P<project_id>[0-9]{1,32})$', api_dispatch(
        GET=base_view,
    )),
    # /projects/<project_id>/labels
    url(r'^projects/(?P<project_id>[0-9]{1,32})/labels$', api_dispatch(
        GET=get_labels,
        POST=add_label,
    )),
    # /projects/<project_id>/labels/<label_id>
    url(r'^projects/(?P<project_id>[0-9]{1,32})/labels/(?P<label_id>[0-9]{1,32})$', api_dispatch(
        PUT=update_label,
        DELETE=delete_label,
    )),
    # /projects/<project_id>/issues
    url(r'^projects/(?P<project_id>[0-9]{1,32})/issues$', api_dispatch(
        GET=get_issues,
        POST=add_issue,
예제 #4
0
파일: urls.py 프로젝트: mengt/Victorique

# error handlers
handler403 = permission_denied
handler404 = page_not_found
handler500 = server_error


# routers
urlpatterns = patterns('',
    url(r'^$', dispatch(GET=base_view)),
    url(r'^login$', dispatch(GET=base_view)),

    # /applications
    url(r'^applications$', api_dispatch(
        GET=get_applications,
    )),
    # /applications/<application_id>/logs
    url(r'^applications/(?P<application_id>[0-9]{1,32})/logs$', api_dispatch(
        GET=get_logs,
    )),
    # /applications/<application_id>/logs/<log_id>
    url(r'^applications/(?P<application_id>[0-9]{1,32})/logs/(?P<log_id>[0-9]{1,32})$', api_dispatch(
        GET=get_log,
        PUT=update_log,
    )),

    # /settings
    url(r'^settings$', dispatch(
        GET=base_view,
    )),