def __unicode__(self): if self.filename: base = 'file:%s:%s' % (self.filename, self.function_name) else: base = '%s:%s' % (self.module_name, self.function_name) parts = ['%s="%s"' % (self.attr_name, html_quote(base))] for name, value in sorted(self.args.items()): parts.append('pyarg-%s="%s"' % (name, html_quote(value))) return ' '.join(parts)
def obj_as_html(self, el): """ Returns the object formatted as HTML. This is used to show the context in log messages. """ ## FIXME: another magic method? if hasattr(el, 'log_description'): return el.log_description(self) elif isinstance(el, _Element): return html_quote(tostring(el)) else: return html_quote(str(el))
def obj_as_html(self, el): """ Returns the object formatted as HTML. This is used to show the context in log messages. """ ## FIXME: another magic method? if hasattr(el, 'log_description'): return el.log_description(self) elif isinstance(el, _Element): return html_quote(tostring(el)) else: return html_quote(unicode(el))
def log_description(self, log=None): """The text to show when this is the context of a log message""" parts = ['<wsgi'] if self.app_string: parts.append('app="%s"' % html_quote(self.app_string)) parts.append('/>') return ' '.join(parts)
def log_description(self, log=None): """The text to show when this is the context of a log message""" parts = ['<dest'] if self.href: if log is not None: parts.append('href="%s"' % html_quote(html_quote(self.href))) else: ## FIXME: definite security issue with the link through here: ## FIXME: Should this be source=True? parts.append('href="<a href="%s" target="_blank">%s</a>"' % (html_quote(log.link_to(self.href)), html_quote(html_quote(self.href)))) if self.pyref: parts.append('pref="%s"' % html_quote(self.pyref)) if self.__next__: parts.append('next="1"') parts.append('/>') return ' '.join(parts)
def log_description(self, log=None): """The text to show when this is the context of a log message""" parts = ["<dest"] if self.href: if log is not None: parts.append('href="%s"' % html_quote(html_quote(self.href))) else: ## FIXME: definite security issue with the link through here: ## FIXME: Should this be source=True? parts.append( 'href="<a href="%s" target="_blank">%s</a>"' % (html_quote(log.link_to(self.href)), html_quote(html_quote(self.href))) ) if self.pyref: parts.append('pref="%s"' % html_quote(self.pyref)) if self.next: parts.append('next="1"') parts.append("/>") return " ".join(parts)
def nl2br(s): if not isinstance(s, html_literal): s = html_quote(s) s = s.replace('\n', '<br>\n') return html_literal(s)
def _format_args(args): """Formats the pyargs dict as XML attributes""" return ' '.join('%s="%s"' % (name, html_quote(value)) for name, value in sorted(args.items()))
def _format_args(args): """Formats the pyargs dict as XML attributes""" return ' '.join( '%s="%s"' % (name, html_quote(value)) for name, value in sorted(args.items()))