diff --git a/VERSION b/VERSION index 55d0853b..50b1cc8f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2012-02-28 22:00:22) stable +Version 1.99.4 (2012-02-29 11:11:18) stable diff --git a/applications/admin/controllers/debug.py b/applications/admin/controllers/debug.py index ce30f15e..23c13519 100644 --- a/applications/admin/controllers/debug.py +++ b/applications/admin/controllers/debug.py @@ -58,6 +58,7 @@ def interact(): lines = {} if filename: + web_debugger.set_burst(2) env = web_debugger.do_environment() f_locals = env['locals'] f_globals = {} diff --git a/gluon/debug.py b/gluon/debug.py index 0fa7a33d..8209185b 100644 --- a/gluon/debug.py +++ b/gluon/debug.py @@ -86,39 +86,28 @@ def communicate(command=None): # New debugger implementation using qdb and a web UI import gluon.contrib.qdb as qdb -from gluon import portalocker - - -def lock(name=''): - from gluon.globals import current - locker = open(os.path.join(current.request.folder, 'debug_%s.lock' % name), - 'a') - portalocker.lock(locker, portalocker.LOCK_EX) - return locker - - -def unlock(locker): - portalocker.unlock(locker) - locker.close() +from threading import RLock +interact_lock = RLock() +run_lock = RLock() def check_interaction(fn): "Decorator to clean and prevent interaction when not available" def check_fn(self, *args, **kwargs): - locker = lock('interact') + interact_lock.acquire() try: if self.filename: self.clear_interaction() fn(self, *args, **kwargs) finally: - unlock(locker) + interact_lock.release() return check_fn class WebDebugger(qdb.Frontend): "Qdb web2py interface" - def __init__(self, pipe, completekey='tab', stdin=None, stdout=None, skip=None): + def __init__(self, pipe, completekey='tab', stdin=None, stdout=None): qdb.Frontend.__init__(self, pipe) self.clear_interaction() @@ -130,21 +119,21 @@ class WebDebugger(qdb.Frontend): # redefine Frontend methods: def run(self): - locker = lock('run') + run_lock.acquire() try: while self.pipe.poll(): qdb.Frontend.run(self) finally: - unlock(locker) + run_lock.release() def interaction(self, filename, lineno, line): # store current status - locker = lock('interact') + interact_lock.acquire() try: self.filename = filename self.lineno = lineno finally: - unlock(locker) + interact_lock.release() def exception(self, title, extype, exvalue, trace, request): self.exception_info = {'title': title, @@ -180,7 +169,7 @@ front_conn = qdb.QueuePipe("parent", parent_queue, child_queue) child_conn = qdb.QueuePipe("child", child_queue, parent_queue) web_debugger = WebDebugger(front_conn) # frontend -qdb_debugger = qdb.Qdb(pipe=child_conn, redirect_stdio=False) # backend +qdb_debugger = qdb.Qdb(pipe=child_conn, redirect_stdio=False, skip=None) # backend dbg = qdb_debugger import gluon.main