def make_zip_file(published_content): """Create the zip archive extra content from the published content :param published_content: a PublishedContent object :return: """ publishable = published_content.content publishable.sha_public = publishable.sha_draft # ensure sha update so that archive is updated to path = os.path.join(published_content.get_extra_contents_directory(), published_content.content_public_slug + '.zip') zip_file = zipfile.ZipFile(path, 'w') versioned = publishable.load_version(None, True) from zds.tutorialv2.views.views_contents import DownloadContent DownloadContent.insert_into_zip(zip_file, versioned.repository.commit(versioned.current_version).tree) zip_file.close()
name='find-article'), url(r'^tribunes/(?P<pk>\d+)/$', ContentOfAuthor.as_view(type='OPINION', context_object_name='opinions'), name='find-opinion'), url(r'^aides/$', ContentsWithHelps.as_view(), name='helps'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/(?P<parent_container_slug>.+)/(?P<container_slug>.+)/$', DisplayContainer.as_view(public_is_prioritary=False), name='view-container'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/(?P<container_slug>.+)/$', DisplayContainer.as_view(public_is_prioritary=False), name='view-container'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/$', DisplayContent.as_view(public_is_prioritary=False), name='view'), url(r'^telecharger/(?P<pk>\d+)/(?P<slug>.+)/$', DownloadContent.as_view(), name='download-zip'), # beta: url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/(?P<parent_container_slug>.+)/(?P<container_slug>.+)/$', DisplayBetaContainer.as_view(public_is_prioritary=False), name='beta-view-container'), url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/(?P<container_slug>.+)/$', DisplayBetaContainer.as_view(public_is_prioritary=False), name='beta-view-container'), url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/$', DisplayBetaContent.as_view(), name='beta-view'), # reactions: url(r'^reactions/ajouter/$', SendNoteFormView.as_view(redirection_is_needed=False), name='add-reaction'), url(r'^reactions/editer/$', UpdateNoteView.as_view(redirection_is_needed=False), name='update-reaction'),
url(r'^articles/(?P<pk>\d+)/$', ContentOfAuthor.as_view(type='ARTICLE', context_object_name='articles'), name="find-article"), url(r'^aides/$', ContentsWithHelps.as_view(), name='helps'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/(?P<parent_container_slug>.+)/(?P<container_slug>.+)/$', DisplayContainer.as_view(public_is_prioritary=False), name='view-container'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/(?P<container_slug>.+)/$', DisplayContainer.as_view(public_is_prioritary=False), name='view-container'), url(r'^(?P<pk>\d+)/(?P<slug>.+)/$', DisplayContent.as_view(public_is_prioritary=False), name='view'), url(r'^telecharger/(?P<pk>\d+)/(?P<slug>.+)/$', DownloadContent.as_view(), name='download-zip'), # beta: url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/(?P<parent_container_slug>.+)/(?P<container_slug>.+)/$', DisplayBetaContainer.as_view(public_is_prioritary=False), name='beta-view-container'), url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/(?P<container_slug>.+)/$', DisplayBetaContainer.as_view(public_is_prioritary=False), name='beta-view-container'), url(r'^beta/(?P<pk>\d+)/(?P<slug>.+)/$', DisplayBetaContent.as_view(), name='beta-view'), # reactions: url(r'^reactions/ajouter/$',