83 ss, so = src.split('.') |
83 ss, so = src.split('.') |
84 return cp.get(ss, so) |
84 return cp.get(ss, so) |
85 |
85 |
86 def upd_052(cp): |
86 def upd_052(cp): |
87 global had_config |
87 global had_config |
|
88 global had_gid_mail |
88 |
89 |
89 had_config = cp.remove_section('config') |
90 had_config = cp.remove_section('config') |
|
91 had_gid_mail = cp.remove_option('misc', 'gid_mail') |
90 add_sections(cp, ('domain', 'account', 'mailbox')) |
92 add_sections(cp, ('domain', 'account', 'mailbox')) |
91 if cp.has_section('domdir'): |
93 if cp.has_section('domdir'): |
92 for src, dst in (('domdir.mode', 'domain.directory_mode'), |
94 for src, dst in (('domdir.mode', 'domain.directory_mode'), |
93 ('domdir.delete', 'domain.delete_directory'), |
95 ('domdir.delete', 'domain.delete_directory'), |
94 ('domdir.base', 'misc.base_directory')): |
96 ('domdir.base', 'misc.base_directory')): |
112 |
114 |
113 # def main(): |
115 # def main(): |
114 if __name__ == '__main__': |
116 if __name__ == '__main__': |
115 sect_opt = [] |
117 sect_opt = [] |
116 had_config = False |
118 had_config = False |
|
119 had_gid_mail = False |
117 cf = get_config_file() |
120 cf = get_config_file() |
118 cp = get_cfg_parser(cf) |
121 cp = get_cfg_parser(cf) |
119 update(cp) |
122 update(cp) |
120 if len(sect_opt): |
123 if len(sect_opt): |
121 had_config = False |
|
122 update_cfg_file(cp, cf) |
124 update_cfg_file(cp, cf) |
123 sect_opt.sort() |
125 sect_opt.sort() |
124 print 'Please have a look at your configuration: %s' %cf |
126 print 'Please have a look at your configuration: %s' %cf |
125 print 'This are your Modified/Renamed/New settings:' |
127 print 'This are your Modified/Renamed/New settings:' |
126 for s_o, st in sect_opt: |
128 for s_o, st in sect_opt: |
127 print '%s %s = %s' % (st, s_o, get_option(cp, s_o)) |
129 print '%s %s = %s' % (st, s_o, get_option(cp, s_o)) |
128 if had_config: |
130 if had_config: |
|
131 print '\nRemoved section "config" with option "done" (obsolte)' |
|
132 if had_gid_mail: |
|
133 print '\nRemoved option "gid_mail" from section "misc" (obsolte)\n' |
|
134 os.sys.exit(0) |
|
135 if had_config or had_gid_mail: |
129 update_cfg_file(cp, cf) |
136 update_cfg_file(cp, cf) |
130 print 'Removed section "config" with option "done" (obsolte)' |
137 if had_config: |
131 print |
138 print '\nRemoved section "config" with option "done" (obsolte)' |
|
139 if had_gid_mail: |
|
140 print '\nRemoved option "gid_mail" from section "misc" (obsolte)\n' |