Simplify the setText method of the Tokenizer class

This commit is contained in:
Veronica Berglyd Olsen
2022-10-18 23:49:48 +02:00
parent ac05dbc55b
commit f34d95edaa
+4 -10
View File
@@ -304,16 +304,10 @@ class Tokenizer(ABC):
if self._theItem is None:
return False
self._theText = ""
if theText is not None:
# If the text is set, just use that
self._theText = theText
else:
# Otherwise, load it from file
theDoc = NWDoc(self.theProject, theHandle)
theText = theDoc.readDocument()
if theText:
self._theText = theText
if theText is None:
theText = NWDoc(self.theProject, theHandle).readDocument() or ""
self._theText = theText
docSize = len(self._theText)
if docSize > nwConst.MAX_DOCSIZE: