[Pywps-commits] r365 - trunk/pywps

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jun 5 15:06:32 CEST 2007


Author: jachym
Date: 2007-06-05 15:06:31 +0200 (Tue, 05 Jun 2007)
New Revision: 365

Added:
   trunk/pywps/debug.py
Log:
new debuging function

Added: trunk/pywps/debug.py
===================================================================
--- trunk/pywps/debug.py	2007-06-05 12:48:54 UTC (rev 364)
+++ trunk/pywps/debug.py	2007-06-05 13:06:31 UTC (rev 365)
@@ -0,0 +1,43 @@
+"""
+Debuging functions
+"""
+# Author:	Jachym Cepicky
+#        	http://les-ejk.cz
+# Lince: 
+# 
+# Web Processing Service implementation
+# Copyright (C) 2006 Jachym Cepicky
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+from sys import stderr as Stderr
+from os import environ as Env
+
+def PyWPSdebug(d,level=0,pref=""):
+
+    try:
+        if Env["PyWPS_DEBUG"] and\
+            int(Env["PyWPS_DEBUG"]) >= level:
+    except (KeyError, ValueError):
+        PyWPS_DEBUG = 0
+
+    # debug messages can be list
+        if type(d) == type([]):
+            for line in d:
+                Stderr.write("PyPWS %s: %s\n" % \
+                        pref,line.strip())
+        else:
+            Stderr.write("PyWPS %s: %s\n" %\
+                    pref,d.strip())
+



More information about the Pywps-commits mailing list