QAR-622 merge -r91846:91877 svn+ssh://svn/svn/linden/branches/scut-newstyle-5

meow-7.2.2
Christian Goetze 2008-07-10 16:52:33 +00:00
parent 81443ef2aa
commit 40d2bb564d
4 changed files with 20 additions and 2 deletions

View File

@ -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):
'''

View File

@ -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()

View File

@ -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

View File

@ -140,6 +140,7 @@ if (EXISTS /etc/debian_version_FAIL)
COMMAND ${PYTHON_EXECUTABLE}
ARGS
${CMAKE_CURRENT_SOURCE_DIR}/test.py
--mode=static
--output=${CMAKE_CURRENT_BINARY_DIR}/py_test_results.txt
--touch=${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt
DEPENDS test.py