# HG changeset patch # User Pascal Volk # Date 1319671978 0 # Node ID d296a020f440427312871da7f4ef08245f5e6b6a # Parent ee6f8ac06197f1e4ef6849d1d15a3e7e4c85c6ab update_config: Set database.module to pyPgSQL only when psycopg2 is unavailable. diff -r ee6f8ac06197 -r d296a020f440 update_config.py --- a/update_config.py Wed Oct 26 18:55:30 2011 +0000 +++ b/update_config.py Wed Oct 26 23:32:58 2011 +0000 @@ -10,6 +10,12 @@ from shutil import copy2 from VirtualMailManager.constants.VERSION import VERSION +try: + import psycopg2 +except ImportError: + has_psycopg2 = False +else: + has_psycopg2 = True def get_config_file(): f = None @@ -110,7 +116,8 @@ ('misc.dovecotvers', 'misc.dovecot_version')): move_option(cp, src, dst) cp.remove_section('maildir') - add_option(cp, 'database.module', 'pyPgSQL') + if not has_psycopg2: + add_option(cp, 'database.module', 'pyPgSQL') set_dovecot_version(cp)