merged recent changes by mariano
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.4 (2012-02-28 22:00:22) stable
|
Version 1.99.4 (2012-02-29 11:11:18) stable
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ def interact():
|
|||||||
lines = {}
|
lines = {}
|
||||||
|
|
||||||
if filename:
|
if filename:
|
||||||
|
web_debugger.set_burst(2)
|
||||||
env = web_debugger.do_environment()
|
env = web_debugger.do_environment()
|
||||||
f_locals = env['locals']
|
f_locals = env['locals']
|
||||||
f_globals = {}
|
f_globals = {}
|
||||||
|
|||||||
+11
-22
@@ -86,39 +86,28 @@ def communicate(command=None):
|
|||||||
# New debugger implementation using qdb and a web UI
|
# New debugger implementation using qdb and a web UI
|
||||||
|
|
||||||
import gluon.contrib.qdb as qdb
|
import gluon.contrib.qdb as qdb
|
||||||
from gluon import portalocker
|
from threading import RLock
|
||||||
|
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
|
interact_lock = RLock()
|
||||||
|
run_lock = RLock()
|
||||||
|
|
||||||
def check_interaction(fn):
|
def check_interaction(fn):
|
||||||
"Decorator to clean and prevent interaction when not available"
|
"Decorator to clean and prevent interaction when not available"
|
||||||
def check_fn(self, *args, **kwargs):
|
def check_fn(self, *args, **kwargs):
|
||||||
locker = lock('interact')
|
interact_lock.acquire()
|
||||||
try:
|
try:
|
||||||
if self.filename:
|
if self.filename:
|
||||||
self.clear_interaction()
|
self.clear_interaction()
|
||||||
fn(self, *args, **kwargs)
|
fn(self, *args, **kwargs)
|
||||||
finally:
|
finally:
|
||||||
unlock(locker)
|
interact_lock.release()
|
||||||
return check_fn
|
return check_fn
|
||||||
|
|
||||||
|
|
||||||
class WebDebugger(qdb.Frontend):
|
class WebDebugger(qdb.Frontend):
|
||||||
"Qdb web2py interface"
|
"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)
|
qdb.Frontend.__init__(self, pipe)
|
||||||
self.clear_interaction()
|
self.clear_interaction()
|
||||||
|
|
||||||
@@ -130,21 +119,21 @@ class WebDebugger(qdb.Frontend):
|
|||||||
# redefine Frontend methods:
|
# redefine Frontend methods:
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
locker = lock('run')
|
run_lock.acquire()
|
||||||
try:
|
try:
|
||||||
while self.pipe.poll():
|
while self.pipe.poll():
|
||||||
qdb.Frontend.run(self)
|
qdb.Frontend.run(self)
|
||||||
finally:
|
finally:
|
||||||
unlock(locker)
|
run_lock.release()
|
||||||
|
|
||||||
def interaction(self, filename, lineno, line):
|
def interaction(self, filename, lineno, line):
|
||||||
# store current status
|
# store current status
|
||||||
locker = lock('interact')
|
interact_lock.acquire()
|
||||||
try:
|
try:
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.lineno = lineno
|
self.lineno = lineno
|
||||||
finally:
|
finally:
|
||||||
unlock(locker)
|
interact_lock.release()
|
||||||
|
|
||||||
def exception(self, title, extype, exvalue, trace, request):
|
def exception(self, title, extype, exvalue, trace, request):
|
||||||
self.exception_info = {'title': title,
|
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)
|
child_conn = qdb.QueuePipe("child", child_queue, parent_queue)
|
||||||
|
|
||||||
web_debugger = WebDebugger(front_conn) # frontend
|
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
|
dbg = qdb_debugger
|
||||||
|
|
||||||
import gluon.main
|
import gluon.main
|
||||||
|
|||||||
Reference in New Issue
Block a user