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
+3 -9
View File
@@ -304,15 +304,9 @@ class Tokenizer(ABC):
if self._theItem is None: if self._theItem is None:
return False return False
self._theText = "" if theText is None:
if theText is not None: theText = NWDoc(self.theProject, theHandle).readDocument() or ""
# 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 self._theText = theText
docSize = len(self._theText) docSize = len(self._theText)