def render_above_lines(self, *args, **kwargs): '''Like .render(), but for ``self.renderer.render_above_lines()`` ''' try: self.update_renderer() for line in self.renderer.render_above_lines(*args, **kwargs): yield line except Exception as e: exc = e try: self.exception('Failed to render: {0}', str(e)) except Exception as e: exc = e yield FailedUnicode(safe_unicode(exc))
def render(self, *args, **kwargs): '''Update/create renderer if needed and pass all arguments further to ``self.renderer.render()``. ''' try: self.update_renderer() return self.renderer.render(*args, **kwargs) except Exception as e: exc = e try: self.exception('Failed to render: {0}', str(e)) except Exception as e: exc = e return FailedUnicode(safe_unicode(exc))
def force_update(self, *args, **kwargs): '''Force a segment to update itself. ''' try: self.update_renderer() return self.renderer.force_update(*args, **kwargs) except Exception as e: exc = e try: self.exception('Failed to force segment update: {0}', str(e)) except Exception as e: exc = e ret = FailedUnicode(safe_unicode(exc)) if kwargs.get('output_width', False): ret = ret, len(ret) return ret
def render(self, *args, **kwargs): '''Update/create renderer if needed and pass all arguments further to ``self.renderer.render()``. ''' try: self.update_renderer() return self.renderer.render(*args, **kwargs) except Exception as e: exc = e try: self.exception('Failed to render: {0}', str(e)) except Exception as e: exc = e ret = FailedUnicode(safe_unicode(exc)) if kwargs.get('output_width', False): ret = ret, len(ret) return ret
def render_above_lines(self, *args, **kwargs): '''Like .render(), but for ``self.renderer.render_above_lines()`` ''' try: self.update_renderer() for line in self.renderer.render_above_lines(*args, **kwargs): yield line except Exception as e: try: self.exception('Failed to render: {0}', str(e)) except Exception as e: # Updates e variable to new value, masking previous one. # Normally it is the same exception (due to raise in case pl is # unset), but it may also show error in logger. Note that latter # is not logged by logger for obvious reasons, thus this also # prevents us from seeing logger traceback. pass yield FailedUnicode(safe_unicode(e))
def render(self, *args, **kwargs): '''Update/create renderer if needed and pass all arguments further to ``self.renderer.render()``. ''' try: self.update_renderer() return self.renderer.render(*args, **kwargs) except Exception as e: try: self.exception('Failed to render: {0}', str(e)) except Exception as e: # Updates e variable to new value, masking previous one. # Normally it is the same exception (due to raise in case pl is # unset), but it may also show error in logger. Note that latter # is not logged by logger for obvious reasons, thus this also # prevents us from seeing logger traceback. pass return FailedUnicode(safe_unicode(e))