Commit 79b4e45a authored by Vincent Pelletier's avatar Vincent Pelletier

Revert a local change which should not have been commited - hurry comits ara bad.

Add a missing word in docstring.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13847 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1b722824
...@@ -108,19 +108,11 @@ from string import strip, split, find, upper, rfind ...@@ -108,19 +108,11 @@ from string import strip, split, find, upper, rfind
from time import time from time import time
from thread import get_ident, allocate_lock from thread import get_ident, allocate_lock
# Connection is unusable, reconnect if possible (if so, don't re-raise the
# exception), otherwise re-raise the exception.
hosed_connection = ( hosed_connection = (
CR.SERVER_GONE_ERROR, CR.SERVER_GONE_ERROR,
CR.SERVER_LOST CR.SERVER_LOST
) )
# Connection is unusable and some earlier query caused the trouble.
# Reconnect *and* re-raise the exception.
dead_connection = (
CR.COMMANDS_OUT_OF_SYNC,
)
key_types = { key_types = {
"PRI": "PRIMARY KEY", "PRI": "PRIMARY KEY",
"MUL": "INDEX", "MUL": "INDEX",
...@@ -360,7 +352,7 @@ class DB(TM): ...@@ -360,7 +352,7 @@ class DB(TM):
def _query(self, query, force_reconnect=False): def _query(self, query, force_reconnect=False):
""" """
Send a to MySQL server. Send a query to MySQL server.
It reconnects automaticaly if needed and the following conditions are It reconnects automaticaly if needed and the following conditions are
met: met:
- It has not just tried to reconnect (ie, this function will not - It has not just tried to reconnect (ie, this function will not
...@@ -374,12 +366,10 @@ class DB(TM): ...@@ -374,12 +366,10 @@ class DB(TM):
except OperationalError, m: except OperationalError, m:
if ((not force_reconnect) and \ if ((not force_reconnect) and \
(self._mysql_lock or self._transactions)) or \ (self._mysql_lock or self._transactions)) or \
m[0] not in (hosed_connection + dead_connection): m[0] not in hosed_connection:
raise raise
# Hm. maybe the db is hosed. Let's restart it. # Hm. maybe the db is hosed. Let's restart it.
self._forceReconnection() self._forceReconnection()
if m[0] in dead_connection:
raise
self.db.query(query) self.db.query(query)
return self.db.store_result() return self.db.store_result()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment