update_config_0.3.x-0.4.py
author Pascal Volk <neverseen@users.sourceforge.net>
Mon, 21 Apr 2008 04:56:01 +0000
changeset 20 55146c78b3fb
parent 14 ebc9b864bc9a
child 24 48ea255e8a85
permissions -rwxr-xr-x
* 'create_tables.pgsql' - Replaced column 'disabled' with columns smpt, pop3, imap and managesieve - updated view, added service columns smpt, pop3, imap and managesieve * 'update_tables_0.3.x-0.4.py' - Updated to consider the points above mentioned * 'vmm.cfg' - Added section »services« with options: smtp, pop3, imap and managesieve * 'update_config_0.3.x-0.4.py' * 'VirtualMailManager/Config.py' - Updated, to add new section »services« * 'VirtualMailManager/Account.py' * 'VirtualMailManager/VirtualMailManager.py' * 'vmm' - Modified, to fit new database structure * 'UPGRADE' * 'INSTALL' - Updated information * 'update_tables_0.4-dev_r24.py' - Added temporary to the repository

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright 2008 VEB IT
# See COPYING for distribution information.
# $Id$

from ConfigParser import ConfigParser

cff = file('/usr/local/etc/vmm.cfg', 'r')
cf = ConfigParser()
cf.readfp(cff)
cff.close()

if not cf.has_option('misc', 'transport') or not cf.has_section('services'):
    cff = file('/usr/local/etc/vmm.cfg', 'w')
    if not cf.has_option('misc', 'transport'):
        cf.set('misc', 'transport', 'dovecot:')
    if not cf.has_section('services'):
        cf.add_section('services')
        for service in ['smtp', 'pop3', 'imap', 'managesieve']:
            cf.set('services', service, 'true')
    cf.write(cff)
    cff.close()