예제 #1
0
def flagged_wagtail_template_view(flag_name, template_name):
    """View that serves Wagtail if a flag is set, and a template if not.

    This uses the wagtail-sharing ServeView to ensure that sharing works
    properly when viewing the page in Wagtail behind a flag.
    """
    return FlaggedTemplateView.as_view(
        fallback=lambda request: ServeView.as_view()(request, request.path),
        flag_name=flag_name,
        template_name=template_name,
        condition=False)
예제 #2
0
def flagged_wagtail_template_view(flag_name, template_name):
    """View that serves Wagtail if a flag is set, and a template if not.

    This uses the wagtail-sharing ServeView to ensure that sharing works
    properly when viewing the page in Wagtail behind a flag.
    """
    return FlaggedTemplateView.as_view(
        fallback=lambda request: ServeView.as_view()(request, request.path),
        flag_name=flag_name,
        template_name=template_name,
        condition=False
    )
예제 #3
0
            content_type='application/javascript'),
        name='regulations3k-service-worker.js'),

    # Explicitly redirect eRegulations URLs to Regulations3000
    url(r'^eregulations/.*', redirect_eregs, name='eregs-redirect'),

    # put financial well-being pages behind feature flag for testing
    flagged_wagtail_only_view(
        'FINANCIAL_WELLBEING_HUB',
        r'^practitioner-resources/financial-well-being-resources/',
        'financial-well-being-resources'),

    # Temporary: HMDA Legacy pages
    # Will be deleted when HMDA API is retired (hopefully Summer 2019)
    url(r'data-research/hmda/explore$',
        FlaggedTemplateView.as_view(flag_name='HMDA_LEGACY_PUBLISH',
                                    template_name='hmda/orange-explorer.html'),
        name='legacy_explorer_published'),
]

# Ask CFPB category and subcategory redirects
category_redirects = [
    url(
        r'^ask-cfpb/category-auto-loans/(.*)$',
        RedirectView.as_view(url='/consumer-tools/auto-loans/',
                             permanent=True)),
    url(
        r'^ask-cfpb/category-bank-accounts-and-services/(.*)$',
        RedirectView.as_view(url='/consumer-tools/bank-accounts/',
                             permanent=True)),
    url(
        r'^ask-cfpb/category-credit-cards/(.*)$',
예제 #4
0
        RedirectView.as_view(url='/practitioner-resources/%(path)s',
                             permanent=True)),
    re_path(
        r'^practitioner-resources/resources-for-older-adults/managing-someone-elses-money/(?P<path>.*)$',  # noqa: E501
        RedirectView.as_view(
            url=
            '/consumer-tools/managing-someone-elses-money/%(path)s',  # noqa: E501
            permanent=True)),
    re_path(
        r'^practitioner-resources/money-as-you-grow/(?P<path>.*)$',
        RedirectView.as_view(url='/consumer-tools/money-as-you-grow/%(path)s',
                             permanent=True)),
    re_path(
        r'^practitioner-resources/resources-youth-employment-programs/transportation-tool/$',  # noqa: E501
        FlaggedTemplateView.as_view(
            flag_name='YOUTH_EMPLOYMENT_SUCCESS',
            template_name='youth_employment_success/index.html'),
        name='youth_employment_success'),

    # retirement redirects
    re_path(
        r'^retirement/(?P<path>.*)$',
        RedirectView.as_view(url='/consumer-tools/retirement/%(path)s',
                             permanent=True)),

    # empowerment redirects
    re_path(
        r'^empowerment/$',
        RedirectView.as_view(
            url='/practitioner-resources/economically-vulnerable/',
            permanent=True)),
예제 #5
0
    re_path(
        r'^practitioner-resources/resources-for-older-adults/managing-someone-elses-money/(?P<path>.*)$',  # noqa: E501
        RedirectView.as_view(
            url='/consumer-tools/managing-someone-elses-money/%(path)s',  # noqa: E501
            permanent=True)
    ),
    re_path(
        r'^practitioner-resources/money-as-you-grow/(?P<path>.*)$',
        RedirectView.as_view(
            url='/consumer-tools/money-as-you-grow/%(path)s',
            permanent=True)
    ),
    re_path(
        r'^practitioner-resources/resources-youth-employment-programs/transportation-tool/$',  # noqa: E501
        FlaggedTemplateView.as_view(
            flag_name='YOUTH_EMPLOYMENT_SUCCESS',
            template_name='youth_employment_success/index.html'
        ),
        name='youth_employment_success'
    ),

    # retirement redirects
    re_path(r'^retirement/(?P<path>.*)$', RedirectView.as_view(
            url='/consumer-tools/retirement/%(path)s',
            permanent=True)),

    # empowerment redirects
    re_path(r'^empowerment/$', RedirectView.as_view(
            url='/practitioner-resources/economically-vulnerable/',
            permanent=True)),

    # students redirects
예제 #6
0

flag_kwargs = {
    'flag_name': FLAG_NAME,
    'fallback_view': wagtail_fail_through,
    'pass_if_set': False,
}


urlpatterns = [
    url(r'^$', IndexView.as_view(**flag_kwargs), name='jobs'),
    url(r'^current-openings/$',
        CurrentOpeningsView.as_view(**flag_kwargs),
        name='current_openings'),
    url(r'application-process', FlaggedTemplateView.as_view(
        template_name='about-us/careers/application-process/index.html',
        **flag_kwargs
    )),
    url(r'working-at-cfpb/$', FlaggedTemplateView.as_view(
        template_name='about-us/careers/working-at-cfpb/index.html',
        **flag_kwargs
    )),
    url(r'students-and-graduates/$', FlaggedTemplateView.as_view(
        template_name='about-us/careers/students-and-graduates/index.html',
        **flag_kwargs
    )),

    # Deprecated /jobs/design-technology-fellows/.
    # Will keep it to keep the external links functioning.
    url(r'^fellowship_form_submit/$',
        fellowship_form_submit,
        name='fellowship_form_submit'),
예제 #7
0
     DocumentServeView.as_view(),
     name='wagtaildocs_serve'),
 url(r'^home/(?P<path>.*)$',
     RedirectView.as_view(url='/%(path)s', permanent=True)),
 url(
     r'^owning-a-home/static/(?P<path>.*)$',
     RedirectView.as_view(url='/static/owning-a-home/static/%(path)s',
                          permanent=True)),
 url(
     r'^owning-a-home/resources/(?P<path>.*)$',
     RedirectView.as_view(url='/static/owning-a-home/resources/%(path)s',
                          permanent=True)),
 url(r'^owning-a-home/closing-disclosure/',
     FlaggedTemplateView.as_view(
         flag_name='OAH_FORM_EXPLAINERS',
         template_name='owning-a-home/closing-disclosure/index.html',
         fallback=SheerTemplateView.as_view(
             template_engine='owning-a-home',
             template_name='closing-disclosure/index.html')),
     name='closing-disclosure'),
 url(r'^owning-a-home/explore-rates/',
     FlaggedTemplateView.as_view(
         flag_name='OAH_EXPLORE_RATES',
         template_name='owning-a-home/explore-rates/index.html',
         fallback=SheerTemplateView.as_view(
             template_engine='owning-a-home',
             template_name='explore-rates/index.html')),
     name='explore-rates'),
 url(r'^owning-a-home/loan-estimate/',
     FlaggedTemplateView.as_view(
         flag_name='OAH_FORM_EXPLAINERS',
         template_name='owning-a-home/loan-estimate/index.html',
예제 #8
0
    # Explicitly redirect eRegulations URLs to Regulations3000
    url(r'^eregulations/.*', redirect_eregs, name='eregs-redirect'),

    # put financial well-being pages behind feature flag for testing
    flagged_wagtail_only_view(
        'FINANCIAL_WELLBEING_HUB',
        r'^practitioner-resources/financial-well-being-resources/',
        'financial-well-being-resources'
    ),

    # Temporary: HMDA Legacy pages
    # Will be deleted when HMDA API is retired (hopefully Summer 2019)
    url(r'data-research/hmda-new/explore$',
        FlaggedTemplateView.as_view(
            flag_name='HMDA_LEGACY_REVIEW',
            template_name='hmda/orange-explorer.html'
        ),
        name='legacy_explorer_draft'
    ),
    url(r'data-research/hmda/explore$',
        FlaggedTemplateView.as_view(
            flag_name='HMDA_LEGACY_PUBLISH',
            template_name='hmda/orange-explorer.html'
        ),
        name='legacy_explorer_published'
    ),

]

if settings.ALLOW_ADMIN_URL:
    patterns = [