Mercurial > piecrust2
view piecrust/chefutil.py @ 113:de257cc40ce1
Re-enable proper caching of rendered segments in server.
The server keeps records on files that are processed while the server is
running. Disk caching is simply disabled for files that are known to use
other pages -- because unlike the baker, there's no cheap way to know
which files are up to date or not, and rendering is faster enough anyway.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 19 Oct 2014 00:30:44 -0700 |
parents | 8703be118430 |
children | 133845647083 |
line wrap: on
line source
import time from colorama import Fore def format_timed(start_time, message, colored=True): end_time = time.clock() time_str = '%8.1f ms' % ((end_time - start_time) * 1000.0) if colored: return '[%s%s%s] %s' % (Fore.GREEN, time_str, Fore.RESET, message) return '[%s] %s' % (time_str, message) def log_friendly_exception(logger, ex): indent = '' while ex: logger.error('%s%s' % (indent, str(ex))) indent += ' ' ex = ex.__cause__ def print_help_item(s, title, description, margin=4, align=25): s.write(margin * ' ') s.write(title) spacer = (align - margin - len(title) - 1) if spacer <= 0: s.write("\n") s.write(' ' * align) else: s.write(' ' * spacer) s.write(description) s.write("\n")