Skip to content

Commit

Permalink
[ADD] ir.qweb render_attribute() hook for postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
amigrave committed Sep 16, 2014
1 parent 0d890ab commit 7893645
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openerp/addons/base/ir/ir_qweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,15 @@ def render_node(self, element, qwebcontext):
for attribute in self._render_att:
if attribute_name[2:].startswith(attribute):
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
else:
if attribute_name[2:] in self._render_tag:
t_render = attribute_name[2:]
template_attributes[attribute_name[2:]] = attribute_value
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:
debugger = template_attributes.get('debug', 'pdb')
Expand Down Expand Up @@ -328,6 +329,9 @@ def render_element(self, element, template_attributes, generated_attributes, qwe
else:
return "<%s%s/>" % (name, generated_attributes)

def render_attribute(self, element, name, value, qwebcontext):
return ' %s="%s"' % (name, escape(value))

# Attributes
def render_att_att(self, element, attribute_name, attribute_value, qwebcontext):
if attribute_name.startswith("t-attf-"):
Expand Down

0 comments on commit 7893645

Please sign in to comment.