Пример #1
0
def purgeTranslationsOnModified(object, event):
    """ When the canonical is purged, also purge the translations. This is
        for content with language independent fields.
    """
    if isPurged(object) and object.isCanonical():
        translations = object.getTranslations(include_canonical=False)
        for translation, state in translations.values():
            notify(Purge(translation))
Пример #2
0
    def test_no_portal_type(self):
        provideUtility(Registry(), IRegistry)
        registry = getUtility(IRegistry)
        registry.registerInterface(IPloneCacheSettings)

        ploneSettings = registry.forInterface(IPloneCacheSettings)
        ploneSettings.purgedContentTypes = ('testtype',)

        content = DummyNotContent()
        self.assertEqual(False, isPurged(content))
Пример #3
0
    def test_not_listed(self):
        provideUtility(Registry(), IRegistry)
        registry = getUtility(IRegistry)
        registry.registerInterface(IPloneCacheSettings)

        ploneSettings = registry.forInterface(IPloneCacheSettings)
        ploneSettings.purgedContentTypes = ('File', 'Image',)

        content = DummyContent()
        self.assertEqual(False, isPurged(content))
Пример #4
0
    def test_no_portal_type(self):
        provideUtility(Registry(), IRegistry)
        registry = getUtility(IRegistry)
        registry.registerInterface(IPloneCacheSettings)

        ploneSettings = registry.forInterface(IPloneCacheSettings)
        ploneSettings.purgedContentTypes = ('testtype', )

        content = DummyNotContent()
        self.assertEqual(False, isPurged(content))
Пример #5
0
    def test_listed(self):
        provideUtility(Registry(), IRegistry)
        registry = getUtility(IRegistry)
        registry.registerInterface(IPloneCacheSettings)

        ploneSettings = registry.forInterface(IPloneCacheSettings)
        ploneSettings.purgedContentTypes = ('File', 'Image', 'testtype',)

        content = DummyContent()
        self.assertTrue(isPurged(content))
Пример #6
0
    def test_listed(self):
        provideUtility(Registry(), IRegistry)
        registry = getUtility(IRegistry)
        registry.registerInterface(IPloneCacheSettings)

        ploneSettings = registry.forInterface(IPloneCacheSettings)
        ploneSettings.purgedContentTypes = ("File", "Image", "testtype")

        content = DummyContent()
        self.assertEquals(True, isPurged(content))
Пример #7
0
def purgeOnMovedOrRemoved(object, event):
    request = getRequest()
    confirmed_delete = ('delete_confirmation' in request.URL
                        and request.REQUEST_METHOD == 'POST'
                        and 'form.submitted' in request.form)
    if IObjectRemovedEvent.providedBy(event) and not confirmed_delete:
        # ignore extra delete events
        return
    # Don't purge when added
    if IObjectAddedEvent.providedBy(event):
        return
    if isPurged(object) and 'portal_factory' not in request.URL:
        notify(Purge(object))
    parent = object.getParentNode()
    if parent:
        notify(Purge(parent))
Пример #8
0
def purgeOnMovedOrRemoved(object, event):
    # Don't purge when added
    if event.oldName is not None and event.oldParent is not None:
        if isPurged(object):
            notify(Purge(object))
Пример #9
0
def purgeOnModified(object, event):
    if isPurged(object):
        notify(Purge(object))
Пример #10
0
def purgeOnMovedOrRemoved(object, event):
    # Don't purge when added
    if event.oldName is not None and event.oldParent is not None:
        if isPurged(object):
            notify(Purge(object))
Пример #11
0
def purgeOnModified(object, event):
    if isPurged(object):
        notify(Purge(object))
Пример #12
0
 def test_no_settings(self):
     provideUtility(Registry(), IRegistry)
     content = DummyContent()
     self.assertEqual(False, isPurged(content))
Пример #13
0
 def test_no_registry(self):
     content = DummyContent()
     self.assertEqual(False, isPurged(content))
Пример #14
0
 def test_no_settings(self):
     provideUtility(Registry(), IRegistry)
     content = DummyContent()
     self.assertEqual(False, isPurged(content))
Пример #15
0
 def test_no_registry(self):
     content = DummyContent()
     self.assertEqual(False, isPurged(content))
Пример #16
0
def purgeOnWorkflowTransition(object, event):
    if isPurged(object):
        notify(Purge(object))
Пример #17
0
def purge(obj):
    """ Purge object
    """
    if isPurged(obj):
        notify(Purge(obj))