Simplify zilencer urls.py configuration to a single file.

The previous separated-out configuration wasn't helping us, and this
makes it easier to make the extra installed applications pluggable in
the following commits.
This commit is contained in:
Tim Abbott
2016-04-26 21:33:37 -07:00
parent 2b30b670e0
commit bf50dd7771
5 changed files with 25 additions and 24 deletions

24
zilencer/urls.py Normal file
View File

@@ -0,0 +1,24 @@
from django.conf.urls import patterns, url, include
urlpatterns = patterns('zilencer.views',
# SSO dispatch page for desktop app with SSO
# Allows the user to enter their email address only,
# and then redirects the user to the proper deployment
# SSO-login page
url(r'^accounts/deployment_dispatch$', 'account_deployment_dispatch',
{'template_name': 'zerver/login.html'}),
)
# Zilencer views following the REST API style
v1_api_and_json_patterns = patterns('zilencer.views',
url('^feedback$', 'rest_dispatch',
{'POST': 'submit_feedback'}),
url('^report_error$', 'rest_dispatch',
{'POST': 'report_error'}),
url('^endpoints$', 'lookup_endpoints_for_user'),
)
urlpatterns += patterns('',
url(r'^api/v1/', include(v1_api_and_json_patterns)),
url(r'^json/', include(v1_api_and_json_patterns)),
)

View File

@@ -1,9 +0,0 @@
from django.conf.urls import patterns, url, include
urlpatterns = patterns('zilencer.views',
url('^feedback$', 'rest_dispatch',
{'POST': 'submit_feedback'}),
url('^report_error$', 'rest_dispatch',
{'POST': 'report_error'}),
url('^endpoints$', 'lookup_endpoints_for_user'),
)

View File

@@ -1,9 +0,0 @@
from django.conf.urls import patterns, url, include
urlpatterns = patterns('zilencer.views',
# SSO dispatch page for desktop app with SSO
# Allows the user to enter their email address only,
# and then redirects the user to the proper deployment
# SSO-login page
url(r'^accounts/deployment_dispatch$', 'account_deployment_dispatch', {'template_name': 'zerver/login.html'}),
)

View File

@@ -262,13 +262,8 @@ v1_api_and_json_patterns = patterns('zerver.views',
'DELETE': 'cleanup_event_queue'}),
)
if not settings.VOYAGER:
v1_api_and_json_patterns += patterns('',
# Still scoped to api/v1/, but under a different project
url(r'^deployments/', include('zilencer.urls.api')),
)
urlpatterns += patterns('',
url(r'^', include('zilencer.urls.pages')),
url(r'^', include('zilencer.urls')),
)
urlpatterns += patterns('',