def open(self): """ To open the document, we read the content from the file path and un- dirty the document. """ try: if File.exists(self.file_path): (self.preamble, self.source) = documentIO.readPreambleAndSourceFromFilePath(self.file_path) self.dirty = False except Exception as e: raise DocumentError("The document cannot be opened: %s" % str(e))
def open(self): """ To open the document, we read the content from the file path and un- dirty the document. """ try: if File.exists(self.file_path): (self.preamble, self.source) = documentIO.readPreambleAndSourceFromFilePath( self.file_path) self.dirty = False except Exception as e: raise DocumentError("The document cannot be opened: %s" % str(e))
def _checkFileExists(self): if not File.exists(self.file_path): raise DocumentReaderError("The file does not exist")