def init(config_in): if 'selector' in config_in: pass else: # twanager global config config = config_in TIDDLER_WRITTEN_HANDLERS.append(_tiddler_written_handler)
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): cachedir = os.path.join(config['root_dir'], WIKI_CACHE_DIR) try: os.mkdir(cachedir) except (IOError, OSError), exc: logging.warn('unable to create %s: %s' % (cachedir, exc)) replace_handler(config['selector'], '/', dict(GET=home)) TIDDLER_WRITTEN_HANDLERS.append(tiddler_written_handler) 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
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): cachedir = os.path.join(config['root_dir'], WIKI_CACHE_DIR) try: os.mkdir(cachedir) except (IOError, OSError), exc: logging.warn('unable to create %s: %s' % (cachedir, exc)) replace_handler(config['selector'], '/', dict(GET=home)) TIDDLER_WRITTEN_HANDLERS.append(tiddler_written_handler) 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