# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1241107902 -7200 # Node ID 0b974e21d762e5f475583bbf68925b69e0542b5b # Parent 1a1c494b88e255e6bc1dda526e7d57239d9d27be hummm diff -r 1a1c494b88e2 -r 0b974e21d762 common/tags.py --- a/common/tags.py Thu Apr 30 17:36:33 2009 +0200 +++ b/common/tags.py Thu Apr 30 18:11:42 2009 +0200 @@ -9,17 +9,19 @@ from cubicweb.common.uilib import simple_sgml_tag class tag(object): - def __init__(self, name): + def __init__(self, name, escapecontent=True): self.name = name - + self.escapecontent = escapecontent + def __call__(self, __content=None, **attrs): + attrs.setdefault('escapecontent', self.escapecontent) return simple_sgml_tag(self.name, __content, **attrs) input = tag('input') textarea = tag('textarea') a = tag('a') span = tag('span') -div = tag('div') +div = tag('div', False) img = tag('img') label = tag('label') option = tag('option') diff -r 1a1c494b88e2 -r 0b974e21d762 common/uilib.py --- a/common/uilib.py Thu Apr 30 17:36:33 2009 +0200 +++ b/common/uilib.py Thu Apr 30 18:11:42 2009 +0200 @@ -204,7 +204,7 @@ # HTML generation helper functions ############################################ -def simple_sgml_tag(tag, content=None, **attrs): +def simple_sgml_tag(tag, content=None, escapecontent=True, **attrs): """generation of a simple sgml tag (eg without children tags) easier content and attributes will be escaped @@ -219,7 +219,9 @@ for attr, value in attrs.items() if value is not None) if content: - value += u'>%s' % (html_escape(unicode(content)), tag) + if escapecontent: + content = html_escape(unicode(content)) + value += u'>%s' % (content, tag) else: value += u'/>' return value