def flagged_wagtail_only_view(flag_name, regex_path, url_name=None): """If flag is set, serve page from Wagtail, otherwise raise 404.""" def this_view_always_raises_http404(request, *args, **kwargs): raise Http404('flag {} not set'.format(flag_name)) return flagged_url( flag_name, regex_path, lambda request: ServeView.as_view()(request, request.path), fallback=this_view_always_raises_http404, name=url_name, )
r'^paying-for-college2/', include_if_app_enabled('paying_for_college', 'paying_for_college.config.urls')), url(r'^credit-cards/agreements/', include('agreements.urls')), url( r'^consumer-tools/retirement/', include_if_app_enabled('retirement_api', 'retirement_api.urls', namespace='retirement_api')), url(r'^data-research/consumer-complaints/$', ComplaintLandingView.as_view(), name='complaint-landing'), # CCDB5-API flagged_url( 'CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls')), # If 'CCDB5_RELEASE' is True, include CCDB5 urls. flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/', include_if_app_enabled('ccdb5_ui', 'ccdb5_ui.config.urls')), url(r'^oah-api/rates/', include_if_app_enabled('ratechecker', 'ratechecker.urls')), url(r'^oah-api/county/', include_if_app_enabled('countylimits', 'countylimits.urls')), url(r'^find-a-housing-counselor/$', HousingCounselorView.as_view(), name='housing-counselor'), url(r'^save-hud-counselors-list/$', HousingCounselorPDFView.as_view(), name='housing-counselor-pdf'),
url(r'^parents/(?P<path>.*)$', RedirectView.as_view( url='/money-as-you-grow/%(path)s', permanent=True)), url(r'fin-ed/privacy-act-statement/', include(fin_ed.urls_for_prefix('privacy-act-statement'))), url(r'^blog/(?P<path>.*)$', RedirectView.as_view( url='/about-us/blog/%(path)s', permanent=True)), url(r'^newsroom/(?P<path>.*)$', RedirectView.as_view( url='/about-us/newsroom/%(path)s', permanent=True)), flagged_url( 'WAGTAIL_ABOUT_US', r'^about-us/newsroom/press-resources/$', lambda req: ServeView.as_view()(req, req.path), fallback=TemplateView.as_view( template_name='newsroom/press-resources/index.html'), name='press-resources'), url(r'^the-bureau/(?P<path>.*)$', RedirectView.as_view(url='/about-us/the-bureau/%(path)s', permanent=True) ), url(r'^about-us/leadership-calendar/(?P<path>.*)$', RedirectView.as_view( url='/about-us/the-bureau/leadership-calendar/%(path)s', permanent=True)), url(r'^doing-business-with-us/(?P<path>.*)$', RedirectView.as_view( url='/about-us/doing-business-with-us/%(path)s', permanent=True)),
url(r'^credit-cards/agreements/', include('agreements.urls')), url(r'^hud-api-replace/', include_if_app_enabled( 'hud_api_replace', 'hud_api_replace.urls', namespace='hud_api_replace')), url(r'^consumer-tools/retirement/', include_if_app_enabled('retirement_api', 'retirement_api.urls')), url(r'^data-research/consumer-complaints/', include_if_app_enabled('complaintdatabase', 'complaintdatabase.urls')), # CCDB5-API flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls') ), # If 'CCDB5_RELEASE' is True, include CCDB5 urls. flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/', include_if_app_enabled( 'ccdb5_ui', 'ccdb5_ui.config.urls' )), url(r'^oah-api/rates/', include_if_app_enabled('ratechecker', 'ratechecker.urls')), url(r'^oah-api/county/', include_if_app_enabled('countylimits', 'countylimits.urls')), url(r'^eregs-api/',
url( r'^paying-for-college2/', include_if_app_enabled('paying_for_college', 'paying_for_college.config.urls')), url(r'^credit-cards/agreements/', include('agreements.urls')), url( r'^consumer-tools/retirement/', include_if_app_enabled('retirement_api', 'retirement_api.urls', namespace='retirement_api')), url(r'^data-research/consumer-complaints/', include_if_app_enabled('complaintdatabase', 'complaintdatabase.urls')), # CCDB5-API flagged_url( 'CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls')), # If 'CCDB5_RELEASE' is True, include CCDB5 urls. flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/', include_if_app_enabled('ccdb5_ui', 'ccdb5_ui.config.urls')), url(r'^oah-api/rates/', include_if_app_enabled('ratechecker', 'ratechecker.urls')), url(r'^oah-api/county/', include_if_app_enabled('countylimits', 'countylimits.urls')), url(r'^eregs-api/', include_if_app_enabled('regcore', 'regcore.urls')), url(r'^eregulations/', include_if_app_enabled('regulations', 'regulations.urls')), url(r'^find-a-housing-counselor/$', HousingCounselorView.as_view(), name='housing-counselor'), url(r'^save-hud-counselors-list/$',
url(r'^owning-a-home/mortgage-closing/', TemplateView.as_view( template_name='owning-a-home/mortgage-closing/index.html'), name='mortgage-closing'), url(r'^owning-a-home/mortgage-estimate/', TemplateView.as_view( template_name='owning-a-home/mortgage-estimate/index.html', ), name='mortgage-estimate'), # Temporarily serve sheer version of OAH Journey sources page. # TODO: remove once page is migrated into Wagtail. flagged_url( 'OAH_JOURNEY_SHEER_SOURCE_PAGE', r'^owning-a-home/process/sources(?P<path>.*)$', lambda req, path: SheerTemplateView.as_view( template_engine='owning-a-home', template_name='process/sources{}index.html'.format(path or '/')) (req), fallback=lambda req, path: ServeView.as_view() (req, 'owning-a-home/sources{}'.format(path or '/')), ), # END TODO # Temporarily serve Wagtail OAH journey pages at `/process/` urls. # TODO: change to redirects after 2018 homebuying campaign. flagged_url( 'OAH_JOURNEY', r'^owning-a-home/process/(?P<path>.*)$', lambda req, path: ServeView.as_view() (req, 'owning-a-home/{}'.format(path or 'prepare/')), fallback=lambda req, path: SheerTemplateView.as_view( template_engine='owning-a-home',
url(r'^credit-cards/agreements/', include('agreements.urls')), url(r'^consumer-tools/retirement/', include_if_app_enabled( 'retirement_api', 'retirement_api.urls', namespace='retirement_api' )), url(r'^data-research/consumer-complaints/$', ComplaintLandingView.as_view(), name='complaint-landing'), # CCDB5-API flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls') ), # If 'CCDB5_RELEASE' is True, include CCDB5 urls. flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/', include_if_app_enabled( 'ccdb5_ui', 'ccdb5_ui.config.urls' )), url(r'^oah-api/rates/', include_if_app_enabled('ratechecker', 'ratechecker.urls')), url(r'^oah-api/county/', include_if_app_enabled('countylimits', 'countylimits.urls')), url(r'^find-a-housing-counselor/$',
include(fin_ed.urls_for_prefix('library-resources'))), url( r'^parents/(?P<path>.*)$', RedirectView.as_view(url='/money-as-you-grow/%(path)s', permanent=True)), url(r'fin-ed/privacy-act-statement/', include(fin_ed.urls_for_prefix('privacy-act-statement'))), url(r'^blog/(?P<path>.*)$', RedirectView.as_view(url='/about-us/blog/%(path)s', permanent=True)), url( r'^newsroom/(?P<path>.*)$', RedirectView.as_view(url='/about-us/newsroom/%(path)s', permanent=True)), flagged_url('WAGTAIL_ABOUT_US', r'^about-us/newsroom/press-resources/$', lambda req: ServeView.as_view()(req, req.path), fallback=TemplateView.as_view( template_name='newsroom/press-resources/index.html'), name='press-resources'), url( r'^the-bureau/(?P<path>.*)$', RedirectView.as_view(url='/about-us/the-bureau/%(path)s', permanent=True)), url( r'^about-us/leadership-calendar/(?P<path>.*)$', RedirectView.as_view( url='/about-us/the-bureau/leadership-calendar/%(path)s', permanent=True)), url( r'^doing-business-with-us/(?P<path>.*)$', RedirectView.as_view(url='/about-us/doing-business-with-us/%(path)s', permanent=True)),
url( r'^how-to-apply-for-a-federal-job-with-the-cfpb/$', TemplateView.as_view( template_name= 'transcripts/how-to-apply-for-a-federal-job-with-the-cfpb/index.html' ), # noqa: E501 name='how-to-apply-for-a-federal-job-with-the-cfpb'), ], namespace='transcripts')), url(r'^paying-for-college/', include_if_app_enabled('comparisontool', 'comparisontool.urls')), url(r'^paying-for-college2/', include('paying_for_college.urls', namespace='paying_for_college')), url(r'^credit-cards/agreements/', include('agreements.urls')), flagged_url( 'PREPAID_AGREEMENTS_SEARCH', r'^data-research/prepaid-accounts/search-agreements/', include('prepaid_agreements.urls', namespace='prepaid_agreements')), url( r'^consumer-tools/retirement/', include_if_app_enabled('retirement_api', 'retirement_api.urls', namespace='retirement_api')), url(r'^data-research/consumer-complaints/$', ComplaintLandingView.as_view(), name='complaint-landing'), # CCDB5-API flagged_url( 'CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls')), # If 'CCDB5_RELEASE' is True, include CCDB5 urls.
url(r'^credit-cards/agreements/', include('agreements.urls')), url(r'^consumer-tools/retirement/', include_if_app_enabled( 'retirement_api', 'retirement_api.urls', namespace='retirement_api' )), url(r'^data-research/consumer-complaints/', include_if_app_enabled('complaintdatabase', 'complaintdatabase.urls')), # CCDB5-API flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/api/v1/', include_if_app_enabled('complaint_search', 'complaint_search.urls') ), # If 'CCDB5_RELEASE' is True, include CCDB5 urls. flagged_url('CCDB5_RELEASE', r'^data-research/consumer-complaints/search/', include_if_app_enabled( 'ccdb5_ui', 'ccdb5_ui.config.urls' )), url(r'^oah-api/rates/', include_if_app_enabled('ratechecker', 'ratechecker.urls')), url(r'^oah-api/county/', include_if_app_enabled('countylimits', 'countylimits.urls')), url(r'^eregs-api/',