arch_no_whitespace = etree.fromstring(
etree.tostring(arch, encoding='utf-8'),
parser=etree.XMLParser(encoding='utf-8', remove_blank_text=True))
- arch_pretty_indent_2 = etree.tostring(
+ return etree.tostring(
arch_no_whitespace, encoding='unicode', pretty_print=True)
- # pretty_print uses a fixed indent level of 2, we want an indent of 4,
- # double up leading spaces.
- def repl(m):
- indent = len(m.group(0)) / 2
- return u' ' * 4 * indent
- # FIXME: If py2.7 only, can use re.M in sub and don't have to do replacement line by line
- return u'\n'.join(
- re.sub(ur'^((?: )+)', repl, line)
- for line in arch_pretty_indent_2.split(u'\n')
- )
-
def save(self, cr, uid, res_id, value, xpath=None, context=None):
""" Update a view section. The view section may embed fields to write