Exemple #1
0
    def setUp(self):
        self.overridden_zds_app = overridden_zds_app
        # don't build PDF to speed up the tests
        overridden_zds_app["content"]["build_pdf_when_published"] = False

        self.staff = StaffProfileFactory().user

        settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
        self.mas = ProfileFactory().user
        overridden_zds_app["member"]["bot_account"] = self.mas.username

        bot = Group(name=overridden_zds_app["member"]["bot_group"])
        bot.save()
        self.external = UserFactory(
            username=overridden_zds_app["member"]["external_account"],
            password="******")

        self.beta_forum = ForumFactory(
            pk=overridden_zds_app["forum"]["beta_forum_id"],
            category=ForumCategoryFactory(position=1),
            position_in_category=1,
        )  # ensure that the forum, for the beta versions, is created

        self.licence = LicenceFactory()
        self.subcategory = SubCategoryFactory()
        self.tag = TagFactory()

        self.user_author = ProfileFactory().user
        self.user_staff = StaffProfileFactory().user
        self.user_guest = ProfileFactory().user

        # create an article
        self.article = PublishableContentFactory(type="ARTICLE")
        self.article.authors.add(self.user_author)
        UserGalleryFactory(gallery=self.article.gallery,
                           user=self.user_author,
                           mode="W")
        self.article.licence = self.licence
        self.article.subcategory.add(self.subcategory)
        self.article.tags.add(self.tag)
        self.article.save()

        # fill it with one extract
        self.article_draft = self.article.load_version()
        self.extract1 = ExtractFactory(container=self.article_draft,
                                       db_object=self.article)

        # then, publish it !
        version = self.article_draft.current_version
        self.published = publish_content(self.article,
                                         self.article_draft,
                                         is_major_update=True)

        self.article.sha_public = version
        self.article.sha_draft = version
        self.article.public_version = self.published
        self.article.save()

        self.articlefeed = LastArticlesFeedRSS()
Exemple #2
0
    def setUp(self):

        # don't build PDF to speed up the tests
        settings.ZDS_APP['content']['build_pdf_when_published'] = False

        self.staff = StaffProfileFactory().user

        settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
        self.mas = ProfileFactory().user
        settings.ZDS_APP['member']['bot_account'] = self.mas.username

        bot = Group(name=settings.ZDS_APP['member']['bot_group'])
        bot.save()
        self.external = UserFactory(
            username=settings.ZDS_APP['member']['external_account'],
            password='******')

        self.beta_forum = ForumFactory(
            pk=settings.ZDS_APP['forum']['beta_forum_id'],
            category=CategoryFactory(position=1),
            position_in_category=1
        )  # ensure that the forum, for the beta versions, is created

        self.licence = LicenceFactory()
        self.subcategory = SubCategoryFactory()

        self.user_author = ProfileFactory().user
        self.user_staff = StaffProfileFactory().user
        self.user_guest = ProfileFactory().user

        # create an article
        self.article = PublishableContentFactory(type='ARTICLE')
        self.article.authors.add(self.user_author)
        UserGalleryFactory(gallery=self.article.gallery,
                           user=self.user_author,
                           mode='W')
        self.article.licence = self.licence
        self.article.subcategory.add(self.subcategory)
        self.article.save()

        # fill it with one extract
        self.article_draft = self.article.load_version()
        self.extract1 = ExtractFactory(container=self.article_draft,
                                       db_object=self.article)

        # then, publish it !
        version = self.article_draft.current_version
        self.published = publish_content(self.article,
                                         self.article_draft,
                                         is_major_update=True)

        self.article.sha_public = version
        self.article.sha_draft = version
        self.article.public_version = self.published
        self.article.save()

        self.articlefeed = LastArticlesFeedRSS()
Exemple #3
0
# coding: utf-8

from django.conf.urls import url

from zds.tutorialv2.views.views_published import ListArticles, DisplayOnlineArticle, DownloadOnlineArticle
from zds.tutorialv2.feeds import LastArticlesFeedRSS, LastArticlesFeedATOM

urlpatterns = [
    # Flux
    url(r'^flux/rss/$', LastArticlesFeedRSS(), name='feed-rss'),
    url(r'^flux/atom/$', LastArticlesFeedATOM(), name='feed-atom'),

    # View
    url(r'^(?P<pk>\d+)/(?P<slug>.+)/$',
        DisplayOnlineArticle.as_view(),
        name='view'),

    # Downloads
    url(r'^md/(?P<pk>\d+)/(?P<slug>.+)\.md$',
        DownloadOnlineArticle.as_view(requested_file='md'),
        name='download-md'),
    url(r'^html/(?P<pk>\d+)/(?P<slug>.+)\.html$',
        DownloadOnlineArticle.as_view(requested_file='html'),
        name='download-html'),
    url(r'^pdf/(?P<pk>\d+)/(?P<slug>.+)\.pdf$',
        DownloadOnlineArticle.as_view(requested_file='pdf'),
        name='download-pdf'),
    url(r'^epub/(?P<pk>\d+)/(?P<slug>.+)\.epub$',
        DownloadOnlineArticle.as_view(requested_file='epub'),
        name='download-epub'),
    url(r'^zip/(?P<pk>\d+)/(?P<slug>.+)\.zip$',
from django.urls import path, re_path
from django.views.generic.base import RedirectView

from zds.tutorialv2.views.contributors import ContentOfContributors
from zds.tutorialv2.views.lists import TagsListView, ContentOfAuthor
from zds.tutorialv2.views.download_online import DownloadOnlineArticle
from zds.tutorialv2.views.display import DisplayOnlineArticle
from zds.tutorialv2.feeds import LastArticlesFeedRSS, LastArticlesFeedATOM

urlpatterns = [
    # Flux
    re_path(r"^flux/rss/$", LastArticlesFeedRSS(), name="feed-rss"),
    re_path(r"^flux/atom/$", LastArticlesFeedATOM(), name="feed-atom"),
    # View
    re_path(r"^(?P<pk>\d+)/(?P<slug>.+)/$",
            DisplayOnlineArticle.as_view(),
            name="view"),
    # Downloads
    re_path(r"^md/(?P<pk>\d+)/(?P<slug>.+)\.md$",
            DownloadOnlineArticle.as_view(requested_file="md"),
            name="download-md"),
    re_path(
        r"^html/(?P<pk>\d+)/(?P<slug>.+)\.html$",
        DownloadOnlineArticle.as_view(requested_file="html"),
        name="download-html",
    ),
    re_path(r"^pdf/(?P<pk>\d+)/(?P<slug>.+)\.pdf$",
            DownloadOnlineArticle.as_view(requested_file="pdf"),
            name="download-pdf"),
    re_path(r"^tex/(?P<pk>\d+)/(?P<slug>.+)\.tex$",
            DownloadOnlineArticle.as_view(requested_file="tex"),