VirtualMailManager/cli/subcommands.py
branchv0.6.x
changeset 471 5d0114f7bb99
parent 469 1ebb6b88f589
child 474 4353981e3a7f
equal deleted inserted replaced
470:807ad4df0774 471:5d0114f7bb99
   425     _print_domain_list(gids, domains, matching)
   425     _print_domain_list(gids, domains, matching)
   426 
   426 
   427 
   427 
   428 def list_pwschemes(ctx_unused):
   428 def list_pwschemes(ctx_unused):
   429     """Prints all usable password schemes and password encoding suffixes."""
   429     """Prints all usable password schemes and password encoding suffixes."""
       
   430     # TODO: Remove trailing colons from keys.
       
   431     # For now it is to late, the translators has stared their work
   430     keys = (_(u'Usable password schemes:'), _(u'Usable encoding suffixes:'))
   432     keys = (_(u'Usable password schemes:'), _(u'Usable encoding suffixes:'))
   431     old_ii, old_si = txt_wrpr.initial_indent, txt_wrpr.subsequent_indent
   433     old_ii, old_si = txt_wrpr.initial_indent, txt_wrpr.subsequent_indent
   432     txt_wrpr.initial_indent = ''
   434     txt_wrpr.initial_indent = txt_wrpr.subsequent_indent = '\t'
   433     indent = 0
   435     txt_wrpr.width = txt_wrpr.width - 8
   434 
   436 
   435     for key in keys:
       
   436         k_len = len(key)
       
   437         if k_len > indent:
       
   438             indent = k_len
       
   439     txt_wrpr.subsequent_indent = (indent + 1) * ' '
       
   440     fmt = '%%-%us %%s' % indent
       
   441     for key, value in zip(keys, list_schemes()):
   437     for key, value in zip(keys, list_schemes()):
   442         w_std('\n'.join(txt_wrpr.wrap(fmt % (key, ' '.join(value)))))
   438         if key.endswith(':'):  # who knows … (see TODO above)
       
   439             key = key.rpartition(':')[0]
       
   440         w_std(key, len(key) * '-')
       
   441         w_std('\n'.join(txt_wrpr.wrap(' '.join(value))), '')
   443 
   442 
   444     txt_wrpr.initial_indent, txt_wrpr.subsequent_indent = old_ii, old_si
   443     txt_wrpr.initial_indent, txt_wrpr.subsequent_indent = old_ii, old_si
       
   444     txt_wrpr.width = txt_wrpr.width + 8
   445 
   445 
   446 
   446 
   447 def relocated_add(ctx):
   447 def relocated_add(ctx):
   448     """create a new record for a relocated user"""
   448     """create a new record for a relocated user"""
   449     if ctx.argc < 3:
   449     if ctx.argc < 3: