Commit 654499dc authored by Ivan Tyagov's avatar Ivan Tyagov

Handle use cases when reference is just None. Add test for this case.

parent 2ef1dd35
...@@ -326,7 +326,9 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -326,7 +326,9 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
certain defined at system level preferences format. certain defined at system level preferences format.
""" """
reference = self.getReference() reference = self.getReference()
if reference is not None:
return len(self._getSearchableReferenceList(reference)) return len(self._getSearchableReferenceList(reference))
return False
def _getSearchableReferenceList(self, text): def _getSearchableReferenceList(self, text):
""" """
......
...@@ -596,6 +596,13 @@ class TestDocument(TestDocumentMixin): ...@@ -596,6 +596,13 @@ class TestDocument(TestDocumentMixin):
[document3], [document3],
sqlresult_to_document_list(document5.getImplicitSuccessorValueList())) sqlresult_to_document_list(document5.getImplicitSuccessorValueList()))
# with empty reference no implicit relation should exists even though some documents
# used to reference us with previous reference
document1.setReference(None)
self.tic()
self.assertSameSet([],
sqlresult_to_document_list(document1.getImplicitPredecessorValueList()))
def testOOoDocument_get_size(self): def testOOoDocument_get_size(self):
# test get_size on OOoDocument # test get_size on OOoDocument
doc = self.portal.document_module.newContent(portal_type='Spreadsheet') doc = self.portal.document_module.newContent(portal_type='Spreadsheet')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment