comparison piecrust/data/piecrustdata.py @ 556:93b656f0af54

serve: Improve debug information in the preview server. Now the debug window only loads debug info on demand.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 12 Aug 2015 23:18:35 -0700
parents 32c7c2d219d2
children f71d576835ee
comparison
equal deleted inserted replaced
555:daf8df5ade7d 556:93b656f0af54
15 self.version = APP_VERSION 15 self.version = APP_VERSION
16 self.url = 'http://bolt80.com/piecrust/' 16 self.url = 'http://bolt80.com/piecrust/'
17 self.branding = 'Baked with <em><a href="%s">PieCrust</a> %s</em>.' % ( 17 self.branding = 'Baked with <em><a href="%s">PieCrust</a> %s</em>.' % (
18 'http://bolt80.com/piecrust/', APP_VERSION) 18 'http://bolt80.com/piecrust/', APP_VERSION)
19 self._page = None 19 self._page = None
20 self._data = None
21 20
22 @property 21 @property
23 def debug_info(self): 22 def debug_info(self):
24 if self._page is not None and self._data is not None: 23 if self._page is not None:
25 try: 24 try:
26 return build_debug_info(self._page, self._data) 25 return build_debug_info(self._page)
27 except Exception as ex: 26 except Exception as ex:
28 logger.exception(ex) 27 logger.exception(ex)
29 return ('An error occured while generating debug info. ' 28 return ('An error occured while generating debug info. '
30 'Please check the logs.') 29 'Please check the logs.')
31 return '' 30 return ''
32 31
33 def _enableDebugInfo(self, page, data): 32 def enableDebugInfo(self, page):
34 self._page = page 33 self._page = page
35 self._data = data
36 34
37 def _debugRenderDebugInfo(self): 35 def _debugRenderDebugInfo(self):
38 return "The very thing you're looking at!" 36 return "The very thing you're looking at!"