Пример #1
0
    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))
Пример #2
0
    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))
Пример #3
0
 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
Пример #4
0
    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
Пример #5
0
    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))
Пример #6
0
    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))