From d6e9383eab9364fcdabf718e3290c564883dde3f Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Thu, 4 Oct 2001 14:32:21 +0000 Subject: list_exists(): This has to know about config.pck and config.pck.last files. --- Mailman/Utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 4254870c4..2a2bfc41e 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -46,11 +46,16 @@ DOT = '.' def list_exists(listname): """Return true iff list `listname' exists.""" - # It is possible that config.db got removed erroneously, in which case we - # can fall back to config.db.last - dbfile = os.path.join(mm_cfg.LIST_DATA_DIR, listname, 'config.db') - lastfile = dbfile + '.last' - return os.path.exists(dbfile) or os.path.exists(lastfile) + # The existance of any of the following file proves the list exists + # : config.pck, config.pck.last, config.db, config.db.last + # + # The former two are for 2.1alpha3 and beyond, while the latter two are + # for all earlier versions. + for ext in ('.pck', '.pck.last', '.db', '.db.last'): + dbfile = os.path.join(mm_cfg.LIST_DATA_DIR, listname, 'config' + ext) + if os.path.exists(dbfile): + return 1 + return 0 def list_names(): -- cgit v1.3.1