def init(config): replace_handler(config["selector"], "/", dict(GET=homepage))
def init(config): replace_handler(config['selector'], '/', dict(GET=index))
content = ''.join(output) file.write(content.encode('UTF-8')) file.close() logging.debug('attempt to write %s to cache' % name) destination_filename = os.path.abspath(link_filename) try: if os.path.exists(destination_filename): os.unlink(destination_filename) os.symlink(os.path.abspath(etag_filename), destination_filename) except (IOError, OSError), exc: logging.warn('unable to link %s <- %s: %s' % (etag_filename, link_filename, exc)) def init(config): try: os.mkdir(WIKI_CACHE_DIR) except (IOError, OSError), exc: logging.warn('unable to create %s: %s' % (WIKI_CACHE_DIR, exc)) replace_handler(config['selector'], '/', dict(GET=home)) def _header_value(headers, name): name = name.lower() try: found_value = [value for header,value in headers if header.lower() == name][0] except IndexError: found_value = None return found_value