minor fix

This commit is contained in:
Miroslav Stampar 2011-11-23 14:26:40 +00:00
parent 9b99530add
commit 14e8ca6d41
3 changed files with 17 additions and 6 deletions

View File

@ -109,6 +109,7 @@ from lib.core.settings import UNENCODED_ORIGINAL_VALUE
from lib.core.settings import UNION_CHAR_REGEX from lib.core.settings import UNION_CHAR_REGEX
from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.core.settings import UNKNOWN_DBMS_VERSION
from lib.core.settings import WEBSCARAB_SPLITTER from lib.core.settings import WEBSCARAB_SPLITTER
from lib.core.threads import getCurrentThreadData
from lib.core.update import update from lib.core.update import update
from lib.parse.configfile import configFileParser from lib.parse.configfile import configFileParser
from lib.parse.payloads import loadPayloads from lib.parse.payloads import loadPayloads
@ -1331,6 +1332,9 @@ def __cleanupOptions():
if conf.code: if conf.code:
conf.code = int(conf.code) conf.code = int(conf.code)
threadData = getCurrentThreadData()
threadData.reset()
def __setConfAttributes(): def __setConfAttributes():
""" """
This function set some needed attributes into the configuration This function set some needed attributes into the configuration

View File

@ -33,10 +33,16 @@ class _ThreadData(threading.local):
""" """
def __init__(self): def __init__(self):
global shared self.reset()
def reset(self):
"""
Resets thread data model
"""
self.disableStdOut = False self.disableStdOut = False
self.hashDBCursor = None self.hashDBCursor = None
self.inTransaction = False
self.lastErrorPage = None self.lastErrorPage = None
self.lastHTTPError = None self.lastHTTPError = None
self.lastRedirectMsg = None self.lastRedirectMsg = None

View File

@ -22,7 +22,6 @@ class HashDB(object):
self.filepath = filepath self.filepath = filepath
self._write_cache = {} self._write_cache = {}
self._cache_lock = threading.Lock() self._cache_lock = threading.Lock()
self._in_transaction = False
def _get_cursor(self): def _get_cursor(self):
threadData = getCurrentThreadData() threadData = getCurrentThreadData()
@ -109,11 +108,13 @@ class HashDB(object):
self.endTransaction() self.endTransaction()
def beginTransaction(self): def beginTransaction(self):
if not self._in_transaction: threadData = getCurrentThreadData()
if not threadData.inTransaction:
self.cursor.execute('BEGIN TRANSACTION') self.cursor.execute('BEGIN TRANSACTION')
self._in_transaction = True threadData.inTransaction = True
def endTransaction(self): def endTransaction(self):
if self._in_transaction: threadData = getCurrentThreadData()
if threadData.inTransaction:
self.cursor.execute('END TRANSACTION') self.cursor.execute('END TRANSACTION')
self._in_transaction = False threadData.inTransaction = False