Пример #1
0
 def available(self):
     if (checkPermission("cmf.ModifyPortalContent", self.context)
             or checkPermission("cmf.ReviewPortalContent", self.context)
         ) and (INewsletterIssue.providedBy(self.context)
                or INewsletter.providedBy(self.context)):
         return True
     return False
 def test_create_issue(self):
     self.issue = api.content.create(
         type="Newsletter Issue",
         id="issue",
         title=u"Issue 1",
         container=self.newsletter,
     )
     self.assertTrue(INewsletterIssue.providedBy(self.issue))
def reset_send_status(event):
    if not INewsletterIssue.providedBy(event.object):
        return
    if event.new_state.id in ['master']:
        status_adapter = ISendStatus(event.object)
        if not status_adapter:
            return
        status_adapter.clear()
    return
Пример #4
0
    def test_ct_newsletter_issue_factory(self):
        fti = queryUtility(IDexterityFTI, name="Newsletter Issue")
        factory = fti.factory
        obj = createObject(factory)

        self.assertTrue(
            INewsletterIssue.providedBy(obj),
            "INewsletterIssue not provided by {0}!".format(obj, ),
        )
Пример #5
0
    def test_ct_newsletter_issue_adding(self):
        setRoles(self.portal, TEST_USER_ID, ["Contributor"])
        obj = api.content.create(
            container=self.parent,
            type="Newsletter Issue",
            id="newsletter_issue",
        )

        self.assertTrue(
            INewsletterIssue.providedBy(obj),
            "INewsletterIssue not provided by {0}!".format(obj.id, ),
        )

        self.assertIn("newsletter_issue", self.parent.objectIds())
        # check that deleting the object works too
        api.content.delete(obj=obj)
        self.assertNotIn("newsletter_issue", self.parent.objectIds())