示例#1
0
 def __call__(self):
     self.cat = getToolByName(self.context, "portal_catalog")
     self.wf_tool = getToolByName(self.context, "portal_workflow")
     self.infos = getInfos(self.context, self.cat, self.wf_tool)
     if self.request.get("form.submitted"):
         if self.request.get("abort") or self.request.get("back"):
             return self.request.RESPONSE.redirect(self.context.absolute_url())
         self.change_states()
     return self.template()
示例#2
0
 def __call__(self):
     self.cat = getToolByName(self.context, 'portal_catalog')
     self.wf_tool = getToolByName(self.context, 'portal_workflow')
     self.infos = getInfos(self.context, self.cat, self.wf_tool)
     if self.request.get('form.submitted'):
         if self.request.get('abort') or self.request.get('back'):
             return self.request.RESPONSE.redirect(
                 self.context.absolute_url())
         self.change_states()
     return self.template()
示例#3
0
    def test_getInfos_transitions_and_review_state(self):
        result = getInfos(self.portal, self.cat, self.wf_tool)

        for item in result:
            self.assertEqual(item['transitions'],
                             [{
                                 'new_review_state': 'Published',
                                 'old_review_state': 'Private',
                                 'id': 'publish',
                                 'title': 'Publish'
                             }, {
                                 'new_review_state': 'Pending review',
                                 'old_review_state': 'Private',
                                 'id': 'submit',
                                 'title': 'Submit for publication'
                             }])
            self.assertEqual(item['review_state'], 'Private')
    def test_getInfos_transitions_and_review_state(self):
        result = getInfos(self.portal, self.cat, self.wf_tool)

        for item in result:
            self.assertEqual(
                item["transitions"],
                [
                    {
                        "new_review_state": "Published",
                        "old_review_state": "Private",
                        "id": "publish",
                        "title": "Publish",
                    },
                    {
                        "new_review_state": "Pending review",
                        "old_review_state": "Private",
                        "id": "submit",
                        "title": "Submit for publication",
                    },
                ],
            )
            self.assertEqual(item["review_state"], "Private")
示例#5
0
 def test_getInfos_level(self):
     result = getInfos(self.portal, self.cat, self.wf_tool)
     self.assertEqual(result[0]['level'], 1)
     self.assertEqual(result[1]['level'], 1)
     self.assertEqual(result[2]['level'], 2)
示例#6
0
    def test_getInfos_order(self):
        result = getInfos(self.portal, self.cat, self.wf_tool)

        self.assertEqual(result[0]['path'], '/plone/document2')
        self.assertEqual(result[1]['path'], '/plone/folder1')
        self.assertEqual(result[2]['path'], '/plone/folder1/document3')
示例#7
0
 def test_getInfos_amount_of_items(self):
     result = getInfos(self.portal, self.cat, self.wf_tool)
     self.assertEqual(len(result), 3)
 def test_getInfos_level(self):
     result = getInfos(self.portal, self.cat, self.wf_tool)
     self.assertEqual(result[0]["level"], 1)
     self.assertEqual(result[1]["level"], 1)
     self.assertEqual(result[2]["level"], 2)
    def test_getInfos_order(self):
        result = getInfos(self.portal, self.cat, self.wf_tool)

        self.assertEqual(result[0]["path"], "/plone/document2")
        self.assertEqual(result[1]["path"], "/plone/folder1")
        self.assertEqual(result[2]["path"], "/plone/folder1/document3")
 def test_getInfos_amount_of_items(self):
     result = getInfos(self.portal, self.cat, self.wf_tool)
     self.assertEqual(len(result), 3)