Simplify the setText method of the Tokenizer class
This commit is contained in:
@@ -304,16 +304,10 @@ 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
|
self._theText = theText
|
||||||
else:
|
|
||||||
# Otherwise, load it from file
|
|
||||||
theDoc = NWDoc(self.theProject, theHandle)
|
|
||||||
theText = theDoc.readDocument()
|
|
||||||
if theText:
|
|
||||||
self._theText = theText
|
|
||||||
|
|
||||||
docSize = len(self._theText)
|
docSize = len(self._theText)
|
||||||
if docSize > nwConst.MAX_DOCSIZE:
|
if docSize > nwConst.MAX_DOCSIZE:
|
||||||
|
|||||||
Reference in New Issue
Block a user