git » pyweave » commit 7b0e91f

Improve debug() and add some messages (not shown by default)

author Alberto Bertogli
2010-04-07 23:09:31 UTC
committer Alberto Bertogli
2010-04-07 23:09:31 UTC
parent 4aacb1f86b9be5adedd29ade729fe58609d07523

Improve debug() and add some messages (not shown by default)

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

pyweave.cgi +7 -2

diff --git a/pyweave.cgi b/pyweave.cgi
index d73d2e4..a80c764 100755
--- a/pyweave.cgi
+++ b/pyweave.cgi
@@ -302,9 +302,13 @@ def path_info(path):
 
 	return p[1], p[2:]
 
-def debug(msg):
+def debug(msg, *args):
 	return
-	sys.stderr.write('DEBUG: ' + str(msg) + '\n')
+	m = msg
+	if args:
+		a = [ str(arg) for arg in args ]
+		m += ' ' + ' '.join(a)
+	sys.stderr.write('DEBUG: ' + m + '\n')
 
 def error(http, msg = None):
 	et = {
@@ -514,6 +518,7 @@ def handle_cgi():
 
 	storage = Storage(data_path + '/' + user)
 
+	debug("HANDLE", user, storage, method)
 	if method == 'GET':
 		do_get(path, storage)
 	elif method == 'PUT':