コード例 #1
0
ファイル: urls.py プロジェクト: isabella232/epa-notice
from django.conf import settings
from django.conf.urls import include, url
from django.http import HttpResponse
# from django.views.generic import TemplateView

from regcore import urls as regcore_urls
from regulations import urls as regsite_urls
from regulations.views.notice_home import NoticeHomeView
from regulations.views.preamble import PreambleView

urlpatterns = [
    url(r'^$',
        NoticeHomeView.as_view(template_name='regulations/nc-homepage.html')),
    # The following overrides the URL set in regulations-site, to not use the
    # daily_cache decorator for the intro.
    url(r'^preamble/(?P<paragraphs>[-\w]+/intro)$',
        PreambleView.as_view(),
        name='chrome_preamble'),
    url(r'^api/', include(regcore_urls))
] + regsite_urls.urlpatterns

if settings.DISABLE_ROBOTS and settings.DISABLE_ROBOTS.lower() == "true":
    urlpatterns.append(
        url(
            r"^robots.txt",
            lambda r: HttpResponse("User-agent: *\nDisallow: /",
                                   content_type="text/plain")))
コード例 #2
0
ファイル: urls.py プロジェクト: xtine/regulations-site
        ChromeSearchView.as_view(), name='chrome_search',
        kwargs={'doc_type': 'cfr'}),
    url(r'^search/preamble/%s$' % preamble_pattern,
        ChromePreambleSearchView.as_view(), name='chrome_search_preamble',
        kwargs={'doc_type': 'preamble'}),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(r'^diff/%s/%s/%s$' %
        (section_pattern, version_pattern, newer_version_pattern),
        lt_cache(ChromeSectionDiffView.as_view()),
        name='chrome_section_diff_view'),

    url(r'^preamble/(?P<doc_number>[\w-]+)/cfr_changes/(?P<section>[\w-]+)$',
        CFRChangesView.as_view(), name='cfr_changes'),
    url(r'^preamble/(?P<paragraphs>[-\w]+(/[-\w]+)*)$',
        PreambleView.as_view(), name='chrome_preamble'),

    # Redirect to version by date
    # Example: http://.../201-3-v/1999/11/8
    url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'
        % paragraph_pattern, redirect_by_date, name='redirect_by_date'),
    # A regulation section with chrome
    # Example: http://.../201-4/2013-10704
    url(r'^%s/%s$' % (section_pattern, version_pattern),
        lt_cache(ChromeView.as_view(partial_class=PartialSectionView)),
        name='chrome_section_view'),
    # Subterp, interpretations of a while subpart, emptypart or appendices
    # Example: http://.../201-Subpart-A-Interp/2013-10706
    #          http://.../201-Subpart-Interp/2013-10706
    #          http://.../201-Appendices-Interp/2013-10706
    url(r'^%s/%s$' % (subterp_pattern, version_pattern),
コード例 #3
0
        lt_cache(ChromeSXSView.as_view()),
        name='chrome_sxs_view'),
    # Search results for non-JS viewers
    # Example: http://.../search?q=term&version=2011-1738
    url(r'^search/%s$' % reg_pattern,
        ChromeSearchView.as_view(),
        name='chrome_search'),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(r'^diff/%s/%s/%s$' %
        (section_pattern, version_pattern, newer_version_pattern),
        lt_cache(ChromeSectionDiffView.as_view()),
        name='chrome_section_diff_view'),

    url(r'^preamble/(?P<paragraphs>[-\w]+(/[-\w]+)*)$',
        PreambleView.as_view(), name='chrome_preamble'),

    # Redirect to version by date
    # Example: http://.../201-3-v/1999/11/8
    url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'
        % paragraph_pattern, redirect_by_date, name='redirect_by_date'),
    # A regulation section with chrome
    # Example: http://.../201-4/2013-10704
    url(r'^%s/%s$' % (section_pattern, version_pattern),
        lt_cache(ChromeView.as_view(partial_class=PartialSectionView)),
        name='chrome_section_view'),
    # Subterp, interpretations of a while subpart, emptypart or appendices
    # Example: http://.../201-Subpart-A-Interp/2013-10706
    #          http://.../201-Subpart-Interp/2013-10706
    #          http://.../201-Appendices-Interp/2013-10706
    url(r'^%s/%s$' % (subterp_pattern, version_pattern),
コード例 #4
0
ファイル: urls.py プロジェクト: eregs/regulations-site
        ChromeSearchView.as_view(), name='chrome_search',
        kwargs={'doc_type': 'cfr'}),
    url(r'^search/preamble/%s$' % preamble_pattern,
        ChromePreambleSearchView.as_view(), name='chrome_search_preamble',
        kwargs={'doc_type': 'preamble'}),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(r'^diff/%s/%s/%s$' %
        (section_pattern, version_pattern, newer_version_pattern),
        lt_cache(ChromeSectionDiffView.as_view()),
        name='chrome_section_diff_view'),

    url(r'^preamble/(?P<doc_number>[\w-]+)/cfr_changes/(?P<section>[\w-]+)$',
        daily_cache(CFRChangesView.as_view()), name='cfr_changes'),
    url(r'^preamble/(?P<paragraphs>[-\w]+(/[-\w]+)*)$',
        daily_cache(PreambleView.as_view()), name='chrome_preamble'),

    # Redirect to version by date
    # Example: http://.../201-3-v/1999/11/8
    url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'
        % paragraph_pattern, redirect_by_date, name='redirect_by_date'),
    # Redirect to version by current date
    # Example: http://.../201-3-v/CURRENT
    url(r'^%s/CURRENT$' % paragraph_pattern,
        redirect_by_current_date, name='redirect_by_current_date'),
    # A regulation section with chrome
    # Example: http://.../201-4/2013-10704
    url(r'^%s/%s$' % (section_pattern, version_pattern),
        lt_cache(ChromeView.as_view(partial_class=PartialSectionView)),
        name='chrome_section_view'),
    # Subterp, interpretations of a while subpart, emptypart or appendices
コード例 #5
0
ファイル: urls.py プロジェクト: govtmirror/regulations-site-1
        ChromeSearchView.as_view(), name='chrome_search',
        kwargs={'doc_type': 'cfr'}),
    url(r'^search/preamble/%s$' % preamble_pattern,
        ChromePreambleSearchView.as_view(), name='chrome_search_preamble',
        kwargs={'doc_type': 'preamble'}),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(r'^diff/%s/%s/%s$' %
        (section_pattern, version_pattern, newer_version_pattern),
        lt_cache(ChromeSectionDiffView.as_view()),
        name='chrome_section_diff_view'),

    url(r'^preamble/(?P<doc_number>[\w-]+)/cfr_changes/(?P<section>[\w-]+)$',
        daily_cache(CFRChangesView.as_view()), name='cfr_changes'),
    url(r'^preamble/(?P<paragraphs>[-\w]+(/[-\w]+)*)$',
        daily_cache(PreambleView.as_view()), name='chrome_preamble'),

    # Redirect to version by date
    # Example: http://.../201-3-v/1999/11/8
    url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'
        % paragraph_pattern, redirect_by_date, name='redirect_by_date'),
    # Redirect to version by current date
    # Example: http://.../201-3-v/CURRENT
    url(r'^%s/CURRENT$' % paragraph_pattern,
        redirect_by_current_date, name='redirect_by_current_date'),
    # A regulation section with chrome
    # Example: http://.../201-4/2013-10704
    url(r'^%s/%s$' % (section_pattern, version_pattern),
        lt_cache(ChromeView.as_view(partial_class=PartialSectionView)),
        name='chrome_section_view'),
    # Subterp, interpretations of a while subpart, emptypart or appendices
コード例 #6
0
        kwargs={'doc_type': 'cfr'}),
    url(r'^search/preamble/%s$' % preamble_pattern,
        ChromePreambleSearchView.as_view(),
        name='chrome_search_preamble',
        kwargs={'doc_type': 'preamble'}),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(r'^diff/%s/%s/%s$' %
        (section_pattern, version_pattern, newer_version_pattern),
        lt_cache(ChromeSectionDiffView.as_view()),
        name='chrome_section_diff_view'),
    url(r'^preamble/(?P<doc_number>[\w-]+)/cfr_changes/(?P<section>[\w-]+)$',
        daily_cache(CFRChangesView.as_view()),
        name='cfr_changes'),
    url(r'^preamble/(?P<paragraphs>[-\w]+(/[-\w]+)*)$',
        daily_cache(PreambleView.as_view()),
        name='chrome_preamble'),

    # Redirect to version by date
    # Example: http://.../201-3-v/1999/11/8
    url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$' %
        paragraph_pattern,
        redirect_by_date,
        name='redirect_by_date'),
    # Redirect to version by current date
    # Example: http://.../201-3-v/CURRENT
    url(r'^%s/CURRENT$' % paragraph_pattern,
        redirect_by_current_date,
        name='redirect_by_current_date'),
    # A regulation section with chrome
    # Example: http://.../201-4/2013-10704