summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-17 22:18:14 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-17 22:18:14 +0200
commit3db4587313b859f0540a8f077b27f2590881113a (patch)
tree5b355a1f8380d0fa88e14a891ee6a88c356db843
parentlittle bugfix at deletePackage dialog (diff)
downloadpyload-3db4587313b859f0540a8f077b27f2590881113a.tar.xz
little fix in debug reports
-rw-r--r--module/PluginThread.py44
-rw-r--r--module/network/HTTPRequest.py3
2 files changed, 21 insertions, 26 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index ceeb0dfc5..e732d07fa 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -53,41 +53,35 @@ class PluginThread(Thread):
"""
dump_name = "debug_%s_%s" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S"))
+ dump = self.getDebugDump(pyfile)
try:
dump_name += ".zip"
- self.writeZipFile(pyfile)
- self.m.core.log.info("Debug Report written to %s" % dump_name)
+ import zipfile
+
+ zip = zipfile.ZipFile(dump_name, "w")
+
+ for f in listdir(join("tmp", pyfile.pluginname)):
+ try:
+ # avoid encoding errors
+ zip.write(join("tmp", pyfile.pluginname, f), save_join(pyfile.pluginname, f))
+ except:
+ pass
+
+ zip.writestr(save_join(pyfile.pluginname, "debug_Report.txt"), dump_name)
+ zip.close()
+
except:
dump_name += ".txt"
- dump = self.writeDebugFile(pyfile)
f = open(dump_name, "wb")
f.write(dump)
f.close()
- self.m.core.log.info("Debug Report written to %s" % dump_name)
-
- def writeZipFile(self, pyfile):
- import zipfile
-
- dump_name = "debug_%s_%s.zip" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S"))
+ self.m.core.log.info("Debug Report written to %s" % dump_name)
- zip = zipfile.ZipFile(dump_name, "w")
-
- for f in listdir(join("tmp", pyfile.pluginname)):
- try:
- # avoid encoding errors
- zip.write(join("tmp", pyfile.pluginname, f), save_join(pyfile.pluginname, f))
- except:
- pass
-
- zip.writestr(save_join(pyfile.pluginname, "debug_Report.txt"), self.writeDebugFile(pyfile))
- zip.close()
-
-
- def writeDebugFile(self, pyfile):
+ def getDebugDump(self, pyfile):
dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % (
self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc())
@@ -238,9 +232,9 @@ class DownloadThread(PluginThread):
continue
except error, e:
- try:
+ if len(e.args) == 2:
code, msg = e.args
- except:
+ else:
code = 0
msg = e.args
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py
index 88f75c828..d8d57e76f 100644
--- a/module/network/HTTPRequest.py
+++ b/module/network/HTTPRequest.py
@@ -21,6 +21,7 @@ import pycurl
from codecs import getincrementaldecoder
from urllib import quote, urlencode
+from httplib import responses
from logging import getLogger
from cStringIO import StringIO
@@ -31,7 +32,7 @@ def myquote(url):
class BadHeader(Exception):
def __init__(self, code, content=""):
- Exception.__init__(self, "Bad server response: %s"% code)
+ Exception.__init__(self, "Bad server response: %s %s"% (code, responses[int(code)]))
self.code = code
self.content = content