示例#1
0
    def __call__(self, **kwargs):
        PostOnly(self.request)
        form = self.request.form
        recurse = form.get('workflow_archive_recurse', False)
        prev_versions = form.get('workflow_archive_previous_versions', False)
        val = {'initiator': form.get('workflow_archive_initiator', ''),
               'custom_message': form.get('workflow_other_reason', '').strip(),
               'reason': form.get('workflow_reasons_radio', 'other'),
        }

        context = self.context
        ploneview = getMultiAdapter((context, self.request), name='plone')
        if ploneview.isDefaultPageInFolder():
            context = self.context.getParentNode()

        if recurse and not prev_versions:
            archive_obj_and_children(context, **val)
        elif recurse and prev_versions:
            archive_obj_and_children(context, **val)
            archive_previous_versions(context, also_children=True, **val)
        elif prev_versions and not recurse:
            archive_object(context, **val)
            archive_previous_versions(context, **val)
        else:
            archive_object(context, **val)

        return "OK"
示例#2
0
    def afterSetUp(self):
        """ After Setup
        """
        self.setRoles(('Manager', ))
        portal = self.portal

        #setup content and translations
        fid = portal.invokeFactory("Folder", 'f1')
        self.folder = portal[fid]
        self.folder.addTranslation('ro')
        self.folder_ro = self.folder.getTranslation('ro')
        assert self.folder_ro.isTranslation() is True
        assert self.folder_ro.getLanguage() == 'ro'
        docid = self.folder.invokeFactory("Document", 'd1')
        self.doc = self.folder[docid]
        self.doc.addTranslation('ro')
        self.doc_ro = self.doc.getTranslation('ro')
        assert self.doc_ro.isTranslation() is True
        assert self.doc_ro.getLanguage() == 'ro'
        assert self.doc_ro.getTranslation() == self.doc
        #archive content
        archive_object(self.folder)
        assert IObjectArchived.providedBy(self.folder)
        archive_children(self.folder)
        assert IObjectArchived.providedBy(self.doc)
        archive_translations(self.folder, also_children=True)
        assert IObjectArchived.providedBy(self.folder_ro)
        assert IObjectArchived.providedBy(self.doc_ro)
示例#3
0
 def test_archive_object(self):
     """ Test history version
     """
     archive_object(self.folder)
     assert IObjectArchived.providedBy(self.folder)
示例#4
0
 def test_archive_object(self):
     """ Test history version
     """
     archive_object(self.folder)
     assert IObjectArchived.providedBy(self.folder)
示例#5
0
    def test_archive_object(self):
        """ Test the archival of the object
        """

        archive_object(self.folder)
        assert IObjectArchived.providedBy(self.folder)