def test_upgrade(self):
     doc3 = self.portal['doc3']
     doc1 = self.portal['doc1']
     self.assertTrue(IReferenceable.providedBy(doc3))
     doc3.setText('<a href="doc1">doc1</a>', mimetype='text/html')
     doc3.addReference(doc1, relationship=referencedRelationship)
     self.assertFalse(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
     migrate_linkintegrity_relations(self.portal)
     self.assertTrue(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
 def test_upgrade(self):
     doc3 = self.portal['doc3']
     doc1 = self.portal['doc1']
     self.assertTrue(IReferenceable.providedBy(doc3))
     doc3.setText('<a href="doc1">doc1</a>', mimetype='text/html')
     doc3.addReference(doc1, relationship=referencedRelationship)
     self.assertFalse(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
     migrate_linkintegrity_relations(self.portal)
     self.assertTrue(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc3))
示例#3
0
def isLinked(obj):
    """Check if the given content object is linked from another one."""
    log_deprecated(
        "utils.isLinked is deprecated, you should use plone.app.linkintegrity.utils.hasIncomingLinks"
    )  # noqa
    from plone.app.linkintegrity.utils import hasIncomingLinks
    return hasIncomingLinks(obj)
 def test_circular_reference_manages_relations(self):
     doc1 = self.portal['doc1']
     doc2 = self.portal['doc2']
     doc3 = self.portal['doc3']
     self.assertFalse(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc2))
     self.assertFalse(hasIncomingLinks(doc3))
     self._set_text(doc1, '<a href="doc2">doc2</a>')
     self._set_text(doc2, '<a href="doc3">doc3</a>')
     self._set_text(doc3, '<a href="doc1">doc1</a>')
     self.assertTrue(hasIncomingLinks(doc1))
     self.assertTrue(hasIncomingLinks(doc2))
     self.assertTrue(hasIncomingLinks(doc3))
示例#5
0
 def test_circular_reference_manages_relations(self):
     doc1 = self.portal['doc1']
     doc2 = self.portal['doc2']
     doc3 = self.portal['doc3']
     self.assertFalse(hasIncomingLinks(doc1))
     self.assertFalse(hasIncomingLinks(doc2))
     self.assertFalse(hasIncomingLinks(doc3))
     self._set_text(doc1, '<a href="doc2">doc2</a>')
     self._set_text(doc2, '<a href="doc3">doc3</a>')
     self._set_text(doc3, '<a href="doc1">doc1</a>')
     self.assertTrue(hasIncomingLinks(doc1))
     self.assertTrue(hasIncomingLinks(doc2))
     self.assertTrue(hasIncomingLinks(doc3))
示例#6
0
def isLinked(obj):
    """Check if the given content object is linked from another one."""
    log_deprecated("utils.isLinked is deprecated, you should use plone.app.linkintegrity.utils.hasIncomingLinks")  # noqa
    from plone.app.linkintegrity.utils import hasIncomingLinks
    return hasIncomingLinks(obj)
示例#7
0
 def test_is_linked(self):
     img1 = self.portal['image1']
     doc1 = self.portal['doc1']
     self._set_text(doc1, '<img src="image1"></img>')
     self.assertTrue(hasIncomingLinks(img1))
 def test_is_linked(self):
     img1 = self.portal['image1']
     doc1 = self.portal['doc1']
     self._set_text(doc1, '<img src="image1"></img>')
     self.assertTrue(hasIncomingLinks(img1))