Commits

Anonymous committed eda333c

Couple of bugfixes to logdebuginfofilter and tidyfilter. Made "development" the default environment

Comments (0)

Files changed (3)

             'server.logFile': '',
             'server.reverseDNS': False,
             'server.threadPool': 0,
-            'server.environment': 'prod',
 
             'session.storageType': 'ram',
             'session.timeout': 60,

lib/filter/logdebuginfofilter.py

             if cpg.threadData.logDebugInfoFilterLogSessionSize and \
                     cpg.config.get('session.storageType'):
                 # Pickle session data to get its size
-                f = StringIO.StringIO()
-                pickle.dump(cpg.request.sessionMap, f, 1)
-                dumpStr = f.getvalue()
-                f.close()
-                logList.append("Session data size: %.02fKB" % (
-                    len(dumpStr)/float(1024)))
+                try:
+                    f = StringIO.StringIO()
+                    pickle.dump(cpg.request.sessionMap, f, 1)
+                    dumpStr = f.getvalue()
+                    f.close()
+                    logList.append("Session data size: %.02fKB" % (
+                        len(dumpStr)/float(1024)))
+                except:
+                    logList.append("Session data size: Unable to pickle session")
 
             debuginfo += ', '.join(logList)
             if cpg.threadData.logDebugInfoFilterLogAsComment:

lib/filter/tidyfilter.py

                 # The HTML is OK, but is it valid XML
                 # Use elementtree to parse XML
                 from elementtree.ElementTree import parse
-                f = StringIO.StringIO(originalBody)
+                f = StringIO.StringIO(originalBody.replace(' ', 'NBSP'))
                 try:
                     tree = parse(f)
                 except: