merged recent changes by mariano

This commit is contained in:
Massimo Di Pierro
2012-02-29 11:11:39 -06:00
parent 6cb0e3aa2e
commit 9c6eafab54
3 changed files with 13 additions and 23 deletions
+1 -1
View File
@@ -1 +1 @@
Version 1.99.4 (2012-02-28 22:00:22) stable
Version 1.99.4 (2012-02-29 11:11:18) stable
+1
View File
@@ -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 = {}
+11 -22
View File
@@ -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