1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-28 10:46:15 +01:00

better linewrapping and output of umlauts

This commit is contained in:
Ludwig Nussel 2010-02-11 17:13:33 +01:00
parent 68dd680cf3
commit 77f01091a4

View File

@ -1609,7 +1609,17 @@ class Request:
who.reverse()
ret += "\n From: %s" % (' -> '.join(who))
if self.descr:
ret += "\n Descr: %s" % (repr(self.descr))
txt = re.sub(r'[^[:isprint:]]', '_', self.descr)
import textwrap
lines = txt.splitlines()
wrapper = textwrap.TextWrapper( width = 80,
initial_indent=' Descr: ',
subsequent_indent=' ')
ret += "\n" + wrapper.fill(lines[0])
wrapper.initial_indent = ' '
for line in lines[1:]:
ret += "\n" + wrapper.fill(line)
ret += "\n"
return ret