90 if clear0 != clear1: |
90 if clear0 != clear1: |
91 clear0 = '' |
91 clear0 = '' |
92 sys.stderr.write('Sorry, passwords do not match\n') |
92 sys.stderr.write('Sorry, passwords do not match\n') |
93 return clear0 |
93 return clear0 |
94 |
94 |
|
95 def _getOrder(): |
|
96 global argc |
|
97 order = () |
|
98 if sys.argv[1] in ['di', 'domaininfo']: |
|
99 order = (('domainname', 0), ('gid', 1), ('transport', 0), |
|
100 ('domaindir', 0), ('accounts', 0), ('aliases', 0)) |
|
101 elif sys.argv[1] in ['ui', 'userinfo']: |
|
102 if argc == 3: |
|
103 order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1), |
|
104 ('transport', 0), ('maildir', 0), ('smtp', 1), ('pop3', 1), |
|
105 ('imap', 1), ('managesieve', 1)) |
|
106 else: |
|
107 order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1), |
|
108 ('transport', 0), ('maildir', 0), ('disk usage', 0), |
|
109 ('smtp', 1), ('pop3', 1), ('imap', 1), ('managesieve', 1)) |
|
110 elif sys.argv[1] in ['gu', 'getuser']: |
|
111 order = (('uid', 1), ('gid', 1), ('address', 0)) |
|
112 return order |
|
113 |
|
114 |
95 def _printInfo(info, title): |
115 def _printInfo(info, title): |
96 msg = title+' information' |
116 msg = title+' information' |
97 print '%s\n%s' % (msg, '-'*len(msg)) |
117 print '%s\n%s' % (msg, '-'*len(msg)) |
98 for k,v in info.items(): |
118 for k,u in _getOrder(): |
99 print '\t%s: %s' % (k.title().ljust(15, '.'), v) |
119 if u: |
|
120 print '\t%s: %s' % (k.upper().ljust(15, '.'), info[k]) |
|
121 else: |
|
122 print '\t%s: %s' % (k.title().ljust(15, '.'), info[k]) |
100 print |
123 print |
101 |
124 |
102 def _printUsers(users, title): |
125 def _printUsers(users, title): |
103 msg = 'Available '+title |
126 msg = 'Available '+title |
104 print '%s\n%s' % (msg, '-'*len(msg)) |
127 print '%s\n%s' % (msg, '-'*len(msg)) |