From 89fb282be5b91aa90120c67841e67ae28cf2d28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barrabin=20Fc=2E=20=E2=9A=91?= Date: Sun, 28 Feb 2016 17:24:47 -0300 Subject: [PATCH 1/3] Chmod +x zeronet.py --- zeronet.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 zeronet.py diff --git a/zeronet.py b/zeronet.py old mode 100644 new mode 100755 From aee83605ab63a7138c3727aa3458d0d6d9bb15ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barrabin=20Fc=2E=20=E2=9A=91?= Date: Thu, 3 Mar 2016 20:40:26 -0300 Subject: [PATCH 2/3] Added exception handling for invalid dbschema.json files --- src/Site/SiteStorage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Site/SiteStorage.py b/src/Site/SiteStorage.py index 03110280..f0e0057c 100644 --- a/src/Site/SiteStorage.py +++ b/src/Site/SiteStorage.py @@ -34,8 +34,12 @@ class SiteStorage: # Load db from dbschema.json def openDb(self, check=True): - schema = self.loadJson("dbschema.json") - db_path = self.getPath(schema["db_file"]) + try: + schema = self.loadJson("dbschema.json") + db_path = self.getPath(schema["db_file"]) + except Exception, err: + raise Exception("dbschema.json is not a valid JSON: %s", err) + if check: if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null self.rebuildDb() From 99aecedd0b3315e35bd6e8774f4b023db4efa459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barrabin=20Fc=2E=20=E2=9A=91?= Date: Thu, 3 Mar 2016 20:47:26 -0300 Subject: [PATCH 3/3] print syntax error when json dbschema.json failed --- src/Site/SiteStorage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Site/SiteStorage.py b/src/Site/SiteStorage.py index f0e0057c..00a0bb1e 100644 --- a/src/Site/SiteStorage.py +++ b/src/Site/SiteStorage.py @@ -38,7 +38,7 @@ class SiteStorage: schema = self.loadJson("dbschema.json") db_path = self.getPath(schema["db_file"]) except Exception, err: - raise Exception("dbschema.json is not a valid JSON: %s", err) + raise Exception("dbschema.json is not a valid JSON: %s" % err) if check: if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null