# # # patch "common.py" # from [63e15e4815638f001c26722a4bac42e7690caa63] # to [8747244a363d332bf91522eb44258c4ecf5cbccc] # # patch "monotone.py" # from [583cd0001e5ac8fc7bf18987e313528d1630c229] # to [fc6c160ddb6cdfccd716a8d30504255bc59d776a] # ============================================================ --- common.py 63e15e4815638f001c26722a4bac42e7690caa63 +++ common.py 8747244a363d332bf91522eb44258c4ecf5cbccc @@ -1,6 +1,17 @@ +import pydoc + +escape_function = pydoc.HTMLRepr().escape + +def type_wrapper(e, x): + if x == None: + return "" + elif type(x) == type([]): + return '
'.join(map(e, x)) + else: + return e(x) + def html_escape(): "returns a function stolen from pydoc that can be used to escape HTML" - import pydoc - return pydoc.HTMLRepr().escape + return lambda x: type_wrapper(escape_function, x) ============================================================ --- monotone.py 583cd0001e5ac8fc7bf18987e313528d1630c229 +++ monotone.py fc6c160ddb6cdfccd716a8d30504255bc59d776a @@ -35,21 +35,18 @@ c_key = c_value = None for line in utility.iter_command(self.base_command + " ls certs %s" % (pipes.quote(id))): if dash_re.match(line): + if c_key != None: c_cert[c_key] = c_value if c_cert: rv.append(c_cert) c_cert = {} elif c_cert != None: m = value_re.match(line) - if m: - key, value = m.groups() - if key != '': - # then we don't have a continuation - if c_key != None: c_cert[c_key] = c_value - c_key, c_value = key, value - else: - c_value += '\n' + value + if not m: continue + key, value = m.groups() + if key != '': + # then we don't have a continuation + if c_key != None: c_cert[c_key] = c_value + c_key, c_value = key, [value] + else: + c_value.append(value) return rv - - - -