summaryrefslogtreecommitdiff
path: root/indra/lib/python
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2008-07-10 16:52:33 +0000
committerChristian Goetze <cg@lindenlab.com>2008-07-10 16:52:33 +0000
commit40d2bb564d35809d7735d2ec06ba988db7327020 (patch)
treed87f4272d64706fdd28ecdf0fe731bf20bbcfe26 /indra/lib/python
parent81443ef2aa7bdb916eb4b38740db9ae3cd1c59cd (diff)
QAR-622 merge -r91846:91877 svn+ssh://svn/svn/linden/branches/scut-newstyle-5
Diffstat (limited to 'indra/lib/python')
-rw-r--r--indra/lib/python/indra/base/config.py7
-rw-r--r--indra/lib/python/indra/ipc/mysql_pool.py12
-rw-r--r--indra/lib/python/indra/util/named_query.py2
3 files changed, 19 insertions, 2 deletions
diff --git a/indra/lib/python/indra/base/config.py b/indra/lib/python/indra/base/config.py
index 9d8da7dd15..1649933d37 100644
--- a/indra/lib/python/indra/base/config.py
+++ b/indra/lib/python/indra/base/config.py
@@ -175,7 +175,12 @@ def load(indra_xml_file = None):
indra_xml_file = realpath(
dirname(realpath(__file__)) + "../../../../../../etc/indra.xml")
- _g_config = IndraConfig(indra_xml_file)
+ try:
+ _g_config = IndraConfig(indra_xml_file)
+ except IOError:
+ # indra.xml was not openable, so let's initialize with an empty dict
+ # some code relies on config behaving this way
+ _g_config = IndraConfig(None)
def dump(indra_xml_file, indra_cfg = None, update_in_mem=False):
'''
diff --git a/indra/lib/python/indra/ipc/mysql_pool.py b/indra/lib/python/indra/ipc/mysql_pool.py
index 2a5a916e74..a2324cf956 100644
--- a/indra/lib/python/indra/ipc/mysql_pool.py
+++ b/indra/lib/python/indra/ipc/mysql_pool.py
@@ -76,3 +76,15 @@ class ConnectionPool(db_pool.TpooledConnectionPool):
converted_kwargs.update(self._kwargs)
conn.connection_parameters = converted_kwargs
return conn
+
+ def clear(self):
+ """ Close all connections that this pool still holds a reference to, leaving it empty."""
+ for conn in self.free_items:
+ try:
+ conn.close()
+ except:
+ pass # even if stuff happens here, we still want to at least try to close all the other connections
+ self.free_items.clear()
+
+ def __del__(self):
+ self.clear()
diff --git a/indra/lib/python/indra/util/named_query.py b/indra/lib/python/indra/util/named_query.py
index 063ef7932e..483a9606c8 100644
--- a/indra/lib/python/indra/util/named_query.py
+++ b/indra/lib/python/indra/util/named_query.py
@@ -47,7 +47,7 @@ except NameError:
from indra.base import llsd
from indra.base import config
-NQ_FILE_SUFFIX = config.get('named-query-file-suffix', '')
+NQ_FILE_SUFFIX = config.get('named-query-file-suffix', '.nq')
NQ_FILE_SUFFIX_LEN = len(NQ_FILE_SUFFIX)
_g_named_manager = None