def read_document(file_obj): """use FileDocument to load document from 'file_obj'""" from solipsis.services.profile.file_document import FileDocument encoding = load_encoding(file_obj) config = CustomConfigParser(encoding) config.readfp(file_obj) file_obj.close() doc = FileDocument() doc.encoding = encoding doc.config = config return doc
def load(self, path): if not os.path.exists(path): display_status(_("profile %s does not exists"\ % os.path.basename(path))) return False else: profile_file = open(path) self.encoding = load_encoding(profile_file) self.config = CustomConfigParser(self.encoding) self.config.readfp(profile_file) profile_file.close() return True