def previewEntry(self, entry): fd, fileName = tempfile.mkstemp('.html') self._tempFiles.append(fileName) title = entry.title.encode('utf-8') text = entry.body.encode('utf-8') bodyType = entry.bodyType.encode('utf-8') html = renderer.renderPage(title, text, bodyType) fp = os.fdopen(fd, 'w') try: fp.write(html) finally: fp.close() uri = 'file://%s' % fileName browserType = self.cfg.getOption('features', 'browser', 'system') command = self.cfg.getOption('features', 'browser_cmd', '') apputils.openURL(uri, browserType, command)
def showHelpIndex(self): fileName = op.join(appconst.PATHS['doc'], 'index.html') uri = 'file://%s' % fileName browserType = self.cfg.getOption('features', 'browser', 'system') command = self.cfg.getOption('features', 'browser_cmd', '') apputils.openURL(uri, browserType, command)