# HG changeset patch # User martin f. krafft # Date 1334436760 -7200 # Node ID c3b98364f03d166ae345cfc779a5ebaef168270f # Parent a582f1452bc00518e680567586eeb5801628895c Display formatted notes in info output If the user/domain object has an attached note, this patch makes the userinfo/domaininfo output print the note, wrapped to the terminal size. diff -r a582f1452bc0 -r c3b98364f03d VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sat Apr 14 21:20:06 2012 +0200 +++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 22:52:40 2012 +0200 @@ -898,7 +898,22 @@ else: w_std(u'\t%s: %s' % (key.title().ljust(17, u'.'), info[key])) print + note = info.get('note', None) + if note is not None: + _print_note(note) +def _print_note(note): + msg = _(u'Note') + w_std(msg, u'-' * len(msg)) + old_ii = txt_wrpr.initial_indent + old_si = txt_wrpr.subsequent_indent + txt_wrpr.initial_indent = txt_wrpr.subsequent_indent = '\t' + txt_wrpr.width -= 8 + for para in note.split('\n'): + w_std(txt_wrpr.fill(para)) + txt_wrpr.width += 8 + txt_wrpr.subsequent_indent = old_si + txt_wrpr.initial_indent = old_ii def _print_list(alist, title): """Print a list."""