def handle(self, *args, **options): part, version = self.get_regulation_version(**options) view = ChromeRegulationView() view.request = HttpRequest() view.request.method = 'GET' context = view.get_context_data(label_id=part, version=version) template = loader.get_template(ChromeRegulationView.template_name) markup = template.render(Context(context)) # markup = builder.render_markup() self.write_file(settings.OFFLINE_OUTPUT_DIR + 'rege.html', markup) front_end_dir = settings.OFFLINE_OUTPUT_DIR + 'static' # If any dir in the path is symlinked, don't replace it if not path.islink(front_end_dir): # Otherwise, copy the static dir to the output if path.exists(front_end_dir): shutil.rmtree(front_end_dir) shutil.copytree('../regulations/static/', front_end_dir) if not path.exists(settings.OFFLINE_OUTPUT_DIR + 'notice'): mkdir(settings.OFFLINE_OUTPUT_DIR + 'notice') all_notices = generator.get_all_notices(options.get('regulation_part')) for notice in all_notices: #notices.fetch_all(api): self.write_file(settings.OFFLINE_OUTPUT_DIR + 'notice/' + notice['document_number'] + ".html", notices.markup(notice))
def handle(self, *args, **options): part, version = self.get_regulation_version(**options) view = ChromeRegulationView() view.request = HttpRequest() view.request.method = 'GET' context = view.get_context_data(label_id=part, version=version) template = loader.get_template(ChromeRegulationView.template_name) markup = template.render(Context(context)) # markup = builder.render_markup() self.write_file(settings.OFFLINE_OUTPUT_DIR + 'rege.html', markup) front_end_dir = settings.OFFLINE_OUTPUT_DIR + 'static' # If any dir in the path is symlinked, don't replace it if not path.islink(front_end_dir): # Otherwise, copy the static dir to the output if path.exists(front_end_dir): shutil.rmtree(front_end_dir) shutil.copytree('../regulations/static/', front_end_dir) if not path.exists(settings.OFFLINE_OUTPUT_DIR + 'notice'): mkdir(settings.OFFLINE_OUTPUT_DIR + 'notice') all_notices = generator.get_all_notices(options.get('regulation_part')) for notice in all_notices: #notices.fetch_all(api): self.write_file( settings.OFFLINE_OUTPUT_DIR + 'notice/' + notice['document_number'] + ".html", notices.markup(notice))
# 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), lt_cache(ChromeSubterpView.as_view()), name=ChromeSubterpView.version_switch_view), #Interpretation of a section/paragraph or appendix #Example: http://.../201-4-Interp/2013-10704 url(r'^%s/%s$' % (interp_pattern, version_pattern), lt_cache(ChromeInterpView.as_view()), name='chrome_interp_view'), #The whole regulation with chrome #Example: http://.../201/2013-10704 url(r'^%s/%s$' % (reg_pattern, version_pattern), lt_cache(ChromeRegulationView.as_view()), name='chrome_regulation_view'), #A regulation paragraph with chrome #Example: http://.../201-2-g/2013-10704 url(r'^%s/%s$' % (paragraph_pattern, version_pattern), lt_cache(ChromeParagraphView.as_view()), name='chrome_paragraph_view'), #A regulation landing page #Example: http://.../201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern), SideBarView.as_view(),
url(r"^%s/%s$" % (section_pattern, version_pattern), ChromeSectionView.as_view(), 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), ChromeSubterpView.as_view(), name=ChromeSubterpView.version_switch_view, ), # Interpretation of a section/paragraph or appendix # Example: http://.../regulation/201-4-Interp/2013-10704 url(r"^%s/%s$" % (interp_pattern, version_pattern), ChromeInterpView.as_view(), name="chrome_interp_view"), # The whole regulation with chrome # Example: http://.../regulation/201/2013-10704 url(r"^%s/%s$" % (reg_pattern, version_pattern), ChromeRegulationView.as_view(), name="chrome_regulation_view"), # A regulation paragraph with chrome # Example: http://.../regulation/201-2-g/2013-10704 url(r"^%s/%s$" % (paragraph_pattern, version_pattern), ChromeParagraphView.as_view(), name="chrome_paragraph_view"), # A regulation landing page # Example: http://.../regulation/201 url(r"^%s$" % reg_pattern, ChromeLandingView.as_view(), name="regulation_landing_view"), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r"^partial/sidebar/%s/%s$" % (paragraph_pattern, version_pattern), SideBarView.as_view(), name="sidebar"), # Load just search results url(r"^partial/search/%s$" % reg_pattern, PartialSearch.as_view(), name="partial_search"), # A diff view of a section (without chrome) url( r"^partial/diff/%s/%s/%s$" % (section_pattern, version_pattern, newer_version_pattern), PartialSectionDiffView.as_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), ChromeSubterpView.as_view(), name=ChromeSubterpView.version_switch_view), #Interpretation of a section/paragraph or appendix #Example: http://.../regulation/201-4-Interp/2013-10704 url(r'^%s/%s$' % (interp_pattern, version_pattern), ChromeInterpView.as_view(), name='chrome_interp_view'), #The whole regulation with chrome #Example: http://.../regulation/201/2013-10704 url(r'^%s/%s$' % (reg_pattern, version_pattern), ChromeRegulationView.as_view(), name='chrome_regulation_view'), #A regulation paragraph with chrome #Example: http://.../regulation/201-2-g/2013-10704 url(r'^%s/%s$' % (paragraph_pattern, version_pattern), ChromeParagraphView.as_view(), name='chrome_paragraph_view'), #A regulation landing page #Example: http://.../regulation/201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern),
# 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), ChromeSubterpView.as_view(), name=ChromeSubterpView.version_switch_view), #Interpretation of a section/paragraph or appendix #Example: http://.../regulation/201-4-Interp/2013-10704 url(r'^%s/%s$' % (interp_pattern, version_pattern), ChromeInterpView.as_view(), name='chrome_interp_view'), #The whole regulation with chrome #Example: http://.../regulation/201/2013-10704 url(r'^%s/%s$' % (reg_pattern, version_pattern), ChromeRegulationView.as_view(), name='chrome_regulation_view'), #A regulation paragraph with chrome #Example: http://.../regulation/201-2-g/2013-10704 url(r'^%s/%s$' % (paragraph_pattern, version_pattern), ChromeParagraphView.as_view(), name='chrome_paragraph_view'), #A regulation landing page #Example: http://.../regulation/201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern), SideBarView.as_view(),