From 756f658e0aa2a95bb372e72fd791d106644d60c2 Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Thu, 4 Sep 2003 07:25:26 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2255 --- py/Boinc/configxml.py | 8 ++++++++ py/Boinc/database.py | 4 +--- tools/add.py | 6 ++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/py/Boinc/configxml.py b/py/Boinc/configxml.py index d6f0bfab6a..773d7852e0 100644 --- a/py/Boinc/configxml.py +++ b/py/Boinc/configxml.py @@ -193,6 +193,14 @@ class RunStateFile(XMLConfig): self.tasks.save() default_xml = '' +default_config_file = None +def default_config(): + '''Reads the default config.xml and returns it.''' + global default_config_file + if not default_config_file: + default_config_file = ConfigFile().read() + return default_config_file + if __name__ == '__main__': config = ConfigFile().read() # print "setting config.enabled = True" diff --git a/py/Boinc/database.py b/py/Boinc/database.py index 8c877f1c88..09ae812f72 100644 --- a/py/Boinc/database.py +++ b/py/Boinc/database.py @@ -600,9 +600,7 @@ def connect(config): def connect_default_config(): """Connect using the default config.xml""" import configxml - config = configxml.ConfigFile().read() - - database.connect(config.config) + connect(configxml.default_config().config) def close(): """Closes the connection to the sql boinc and deletes the Boincdb object.""" diff --git a/tools/add.py b/tools/add.py index ace2f48507..d24ef9b2cc 100755 --- a/tools/add.py +++ b/tools/add.py @@ -33,12 +33,10 @@ add.py workunit (TODO) add.py result (TODO) ''' import boinc_path_config -from Boinc import database, db_mid, configxml, util +from Boinc import database, db_mid, util import sys, os, getopt, md5, time -config = boinc_config.BoincConfig('../../projects/client_test/config.xml').read() - -database._connectp('boinc_client_test','','') +database.connect_default_config() CREATE_TIME = ['?create_time', int(time.time())]