with open(os.path.expanduser(configfile), 'wb') as f: config.write(f) self.send_response(302) self.send_header('Location', '/') self.end_headers() return elif parts[0] == 'math' or ( parts[0] == 'wiki' and parts[1] == 'math'): # second case is workaround for bug in dumps if not storage.is_readable(): self.send_response(302) self.send_header('Location', '/choose_data') return self.write_header('image/png', charset=None, expires=True) data = storage.get_math_image(parts[-1][:32]) if data is not None: self.wfile.write(data) return elif parts[0] in ('wiki', 'articles'): if not storage.is_readable(): self.send_response(302) self.send_header('Location', '/choose_data') return url = '/'.join(parts[1:]) self.output_wiki_page(url) return elif parts[0] == 'exit': self.do_exit() return