Mercurial > piecrust2
comparison piecrust/data/debug.py @ 96:0445a2232de7
Improvements and fixes to incremental baking.
* Better handling of the render pass during page rendering.
* Used sources are paired with the pass they were used in.
* Proper use and invalidation of the rendered segments cache based on render
passes.
* The `Assetor` is also better tracking what was used in a page.
* Add flags on a page to get better caching information for the debug window.
* Property invalidation of the previous bake record when needed.
* Better information about why pages are delayed.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 07 Sep 2014 23:48:57 -0700 |
parents | 395eb38f2dfb |
children | d7a548ebcd58 |
comparison
equal
deleted
inserted
replaced
95:cb6eadea0845 | 96:0445a2232de7 |
---|---|
2 import io | 2 import io |
3 import html | 3 import html |
4 import logging | 4 import logging |
5 import collections | 5 import collections |
6 from piecrust import APP_VERSION, PIECRUST_URL | 6 from piecrust import APP_VERSION, PIECRUST_URL |
7 from piecrust.page import FLAG_RAW_CACHE_VALID | |
7 | 8 |
8 | 9 |
9 logger = logging.getLogger(__name__) | 10 logger = logging.getLogger(__name__) |
10 | 11 |
11 | 12 |
58 output.close() | 59 output.close() |
59 | 60 |
60 | 61 |
61 def _do_build_debug_info(page, data, output): | 62 def _do_build_debug_info(page, data, output): |
62 app = page.app | 63 app = page.app |
63 exec_info = app.env.exec_info_stack.current_page_info | |
64 | 64 |
65 print('<div id="piecrust-debug-info" style="%s">' % CSS_DEBUGINFO, file=output) | 65 print('<div id="piecrust-debug-info" style="%s">' % CSS_DEBUGINFO, file=output) |
66 | 66 |
67 print('<div>', file=output) | 67 print('<div>', file=output) |
68 print('<p style="%s"><strong>PieCrust %s</strong> — ' % (CSS_P, APP_VERSION), file=output) | 68 print('<p style="%s"><strong>PieCrust %s</strong> — ' % (CSS_P, APP_VERSION), file=output) |
69 | 69 |
70 # If we have some execution info in the environment, | 70 # If we have some execution info in the environment, |
71 # add more information. | 71 # add more information. |
72 if exec_info: | 72 if page.flags & FLAG_RAW_CACHE_VALID: |
73 if exec_info.was_cache_valid: | 73 output.write('baked this morning') |
74 output.write('baked this morning') | 74 else: |
75 output.write('baked just now') | |
76 | |
77 if app.cache.enabled: | |
78 if app.env.was_cache_cleaned: | |
79 output.write(', from a brand new cache') | |
75 else: | 80 else: |
76 output.write('baked just now') | 81 output.write(', from a valid cache') |
77 | |
78 if app.cache.enabled: | |
79 if app.env.was_cache_cleaned: | |
80 output.write(', from a brand new cache') | |
81 else: | |
82 output.write(', from a valid cache') | |
83 else: | |
84 output.write(', with no cache') | |
85 | |
86 else: | 82 else: |
87 output.write('no caching information available') | 83 output.write(', with no cache') |
88 | 84 |
89 output.write(', ') | 85 output.write(', ') |
90 if app.env.start_time != 0: | 86 if app.env.start_time != 0: |
91 output.write('in __PIECRUST_TIMING_INFORMATION__') | 87 output.write('in __PIECRUST_TIMING_INFORMATION__') |
92 else: | 88 else: |