Merge pull request #1027 from cclauss/patch-2
Old style exceptions --> new style
This commit is contained in:
commit
de550d7cae
11 changed files with 17 additions and 17 deletions
|
@ -53,7 +53,7 @@ class UiWebsocketPlugin(object):
|
|||
try:
|
||||
text = self.decrypt(encrypted_text.decode("base64"), privatekey)
|
||||
texts.append(text)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
texts.append(None)
|
||||
|
||||
if type(param) == list:
|
||||
|
|
|
@ -59,7 +59,7 @@ class UiRequestPlugin(object):
|
|||
content_type = self.getContentType(file_path)
|
||||
self.sendHeader(200, content_type=content_type, noscript=kwargs.get("header_noscript", False))
|
||||
return self.streamFile(file)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.log.debug("Error opening archive file: %s" % err)
|
||||
return self.error404(path)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ if os.path.isfile("%s/mutes.json" % config.data_dir):
|
|||
data = json.load(open("%s/mutes.json" % config.data_dir))
|
||||
mutes = data.get("mutes", {})
|
||||
site_blacklist = data.get("site_blacklist", {})
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
mutes = {}
|
||||
site_blacklist = {}
|
||||
else:
|
||||
|
|
|
@ -60,7 +60,7 @@ class UiWebsocketPlugin(object):
|
|||
else:
|
||||
res = site.storage.query(query + " ORDER BY date_added DESC LIMIT %s" % limit)
|
||||
|
||||
except Exception, err: # Log error
|
||||
except Exception as err: # Log error
|
||||
self.log.error("%s feed query %s error: %s" % (address, name, err))
|
||||
continue
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class ContentDbPlugin(object):
|
|||
content = site.content_manager.contents[row["inner_path"]]
|
||||
try:
|
||||
num += self.setContentFilesOptional(site, row["inner_path"], content, cur=cur)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.log.error("Error loading %s into file_optional: %s" % (row["inner_path"], err))
|
||||
cur.execute("COMMIT")
|
||||
cur.close()
|
||||
|
@ -159,7 +159,7 @@ class ContentDbPlugin(object):
|
|||
cur = self
|
||||
try:
|
||||
cur.execute("BEGIN")
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.log.warning("Transaction begin error %s %s: %s" % (site, content_inner_path, Debug.formatException(err)))
|
||||
|
||||
num = 0
|
||||
|
@ -195,7 +195,7 @@ class ContentDbPlugin(object):
|
|||
if cur == self:
|
||||
try:
|
||||
cur.execute("END")
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.log.warning("Transaction end error %s %s: %s" % (site, content_inner_path, Debug.formatException(err)))
|
||||
return num
|
||||
|
||||
|
@ -387,7 +387,7 @@ class ContentDbPlugin(object):
|
|||
site.content_manager.optionalRemove(row["inner_path"], row["hash_id"], row["size"])
|
||||
site.storage.delete(row["inner_path"])
|
||||
need_delete -= row["size"]
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
site.log.error("Error deleting %s: %s" % (row["inner_path"], err))
|
||||
|
||||
if need_delete <= 0:
|
||||
|
|
|
@ -137,7 +137,7 @@ class UiWebsocketPlugin(object):
|
|||
|
||||
try:
|
||||
site.storage.delete(inner_path)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
return self.response(to, {"error": "File delete error: %s" % err})
|
||||
|
||||
self.response(to, "ok")
|
||||
|
|
|
@ -79,7 +79,7 @@ class ContentDbPlugin(object):
|
|||
"INSERT INTO peer (site_id, address, port, hashfield, time_added) VALUES (?, ?, ?, ?, ?)",
|
||||
self.iteratePeers(site)
|
||||
)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
site.log.error("Save peer error: %s" % err)
|
||||
finally:
|
||||
cur.execute("END")
|
||||
|
|
|
@ -171,7 +171,7 @@ class UiWebsocketPlugin(object):
|
|||
size_total = size_other = site.settings["size"]
|
||||
|
||||
# Bar
|
||||
for extension, color in extensions:
|
||||
for extension as color in extensions:
|
||||
if extension == "Total":
|
||||
continue
|
||||
if extension == "Other":
|
||||
|
@ -502,7 +502,7 @@ class UiWebsocketPlugin(object):
|
|||
self.cmd("notification", ["geolite-done", _["GeoLite2 City database downloaded!"], 5000])
|
||||
time.sleep(2) # Wait for notify animation
|
||||
return True
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.log.error("Error downloading %s: %s" % (db_url, err))
|
||||
pass
|
||||
self.cmd("notification", [
|
||||
|
|
|
@ -60,7 +60,7 @@ class SiteManagerPlugin(object):
|
|||
return data["zeronet"].get(sub_domain)
|
||||
# Not found
|
||||
return address
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
log.debug("Dnschain.net %s resolve error: %s" % (domain, Debug.formatException(err)))
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ class SiteManagerPlugin(object):
|
|||
return data["zeronet"].get(sub_domain)
|
||||
# Not found
|
||||
return address
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
log.debug("Dnschain.info %s resolve error: %s" % (domain, Debug.formatException(err)))
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
try:
|
||||
from stem.control import Controller
|
||||
stem_found = True
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
print "STEM NOT FOUND! %s" % err
|
||||
stem_found = False
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@ if not os.path.isdir(config.log_dir):
|
|||
os.mkdir(config.log_dir)
|
||||
try:
|
||||
os.chmod(config.log_dir, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
print "Can't change permission of %s: %s" % (config.log_dir, err)
|
||||
|
||||
if not os.path.isdir(config.data_dir):
|
||||
os.mkdir(config.data_dir)
|
||||
try:
|
||||
os.chmod(config.data_dir, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
print "Can't change permission of %s: %s" % (config.data_dir, err)
|
||||
|
||||
if not os.path.isfile("%s/sites.json" % config.data_dir):
|
||||
|
|
Loading…
Reference in a new issue