[ADD] ir.qweb render_attribute() hook for postprocessing
This commit is contained in:
parent
0d890ab76e
commit
7893645d9c
|
@ -265,14 +265,15 @@ class QWeb(orm.AbstractModel):
|
||||||
for attribute in self._render_att:
|
for attribute in self._render_att:
|
||||||
if attribute_name[2:].startswith(attribute):
|
if attribute_name[2:].startswith(attribute):
|
||||||
att, val = self._render_att[attribute](self, element, attribute_name, attribute_value, qwebcontext)
|
att, val = self._render_att[attribute](self, element, attribute_name, attribute_value, qwebcontext)
|
||||||
generated_attributes += val and ' %s="%s"' % (att, escape(val)) or " "
|
if val:
|
||||||
|
generated_attributes += self.render_attribute(element, att, val, qwebcontext)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if attribute_name[2:] in self._render_tag:
|
if attribute_name[2:] in self._render_tag:
|
||||||
t_render = attribute_name[2:]
|
t_render = attribute_name[2:]
|
||||||
template_attributes[attribute_name[2:]] = attribute_value
|
template_attributes[attribute_name[2:]] = attribute_value
|
||||||
else:
|
else:
|
||||||
generated_attributes += ' %s="%s"' % (attribute_name, escape(attribute_value))
|
generated_attributes += self.render_attribute(element, attribute_name, escape(attribute_value), qwebcontext)
|
||||||
|
|
||||||
if 'debug' in template_attributes:
|
if 'debug' in template_attributes:
|
||||||
debugger = template_attributes.get('debug', 'pdb')
|
debugger = template_attributes.get('debug', 'pdb')
|
||||||
|
@ -328,6 +329,9 @@ class QWeb(orm.AbstractModel):
|
||||||
else:
|
else:
|
||||||
return "<%s%s/>" % (name, generated_attributes)
|
return "<%s%s/>" % (name, generated_attributes)
|
||||||
|
|
||||||
|
def render_attribute(self, element, name, value, qwebcontext):
|
||||||
|
return ' %s="%s"' % (name, escape(value))
|
||||||
|
|
||||||
# Attributes
|
# Attributes
|
||||||
def render_att_att(self, element, attribute_name, attribute_value, qwebcontext):
|
def render_att_att(self, element, attribute_name, attribute_value, qwebcontext):
|
||||||
if attribute_name.startswith("t-attf-"):
|
if attribute_name.startswith("t-attf-"):
|
||||||
|
|
Loading…
Reference in New Issue