From 80880a4ad38da553e26a9c7e6d655fa38c21d5dc Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 08:41:54 +0200 Subject: [PATCH 01/10] Bugfix: self keyword was used outside of a class. --- server/tocUtil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/tocUtil.py b/server/tocUtil.py index 3d50952..f10f7ab 100755 --- a/server/tocUtil.py +++ b/server/tocUtil.py @@ -102,7 +102,7 @@ def addTocEntry(domain, filePath, userid=None): if userid is not None: acl = db.getAcl(group_uuid, userid) if not acl['create']: - self.log.info("unauthorized access to group:" + group_uuid) + db.log.info("unauthorized access to group:" + group_uuid) raise IOError(errno.EACCES) # unauthorized log.info("createExternalLink -- uuid %s, domain: %s, linkName: %s", group_uuid, domain, linkName) db.createExternalLink(group_uuid, domain, '/', linkName) @@ -112,7 +112,7 @@ def addTocEntry(domain, filePath, userid=None): if userid is not None: acl = db.getAcl(group_uuid, userid) if not acl['create']: - self.log.info("unauthorized access to group:" + group_uuid) + db.log.info("unauthorized access to group:" + group_uuid) raise IOError(errno.EACCES) # unauthorized # create subgroup and link to parent group subgroup_uuid = db.createGroup() From b62d40ced3d60359d43b2d68d1613fb079716585 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 08:43:59 +0200 Subject: [PATCH 02/10] Bugfix: Add missing import of errno module. --- server/tocUtil.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server/tocUtil.py b/server/tocUtil.py index f10f7ab..8c5da14 100755 --- a/server/tocUtil.py +++ b/server/tocUtil.py @@ -9,6 +9,7 @@ # distribution tree. If you do not have access to this file, you may # # request a copy from help@hdfgroup.org. # ############################################################################## +import errno import os import os.path as op import re From 09fd279155a08b1f20b265ee826c344c86da0a08 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 08:49:18 +0200 Subject: [PATCH 03/10] Bugfix: Add missing import tornado.web Is is necessary for class definition: class BaseHandler(tornado.web.RequestHandler): --- server/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server/app.py b/server/app.py index e0e8a85..ab65a08 100755 --- a/server/app.py +++ b/server/app.py @@ -23,6 +23,7 @@ import os.path as op import json import tornado.httpserver +import tornado.web import sys import ssl import base64 From cbff944a21177f64decd313ebcc530c2d0ea058c Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:05:50 +0200 Subject: [PATCH 04/10] Bugfix: Add missing self. --- server/app.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/app.py b/server/app.py index ab65a08..b1bb0ce 100755 --- a/server/app.py +++ b/server/app.py @@ -581,7 +581,7 @@ def put(self): body = json_decode(self.request.body) except ValueError as e: msg = "JSON Parser Error: " + e.message - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) childUuid = None @@ -1395,7 +1395,7 @@ def getSliceQueryParam(self, dim, extent): fields = dim_query.split(":") if len(fields) > 3: msg = "Bad Request: Too many ':' seperators for dimension: " + str(dim) - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) try: if fields[0]: @@ -1518,7 +1518,7 @@ def get(self): limit = int(limit) # convert to int except ValueError as e: msg = "invalid Limit: " + e.message - log.info(msg) + self.log.info(msg) raise HTTPError(400, msg) if query_selection: @@ -1739,7 +1739,7 @@ def put(self): msg = "JSON Parser Error: " + e.message except AttributeError: msg = "JSON Parser Error" - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) if "value" in body: @@ -1882,7 +1882,7 @@ def getRequestCollectionName(self): npos = uri.find('/') if npos < 0: - log.info("bad uri") + self.log.info("bad uri") raise HTTPError(400) uri = uri[(npos+1):] npos = uri.find('/') # second '/' @@ -1912,7 +1912,7 @@ def get(self): try: limit = int(limit) except ValueError: - log.info("expected int type for limit") + self.log.info("expected int type for limit") raise HTTPError(400) marker = self.get_query_argument("Marker", None) @@ -1975,7 +1975,7 @@ def get(self): else: if len(responseItems) == 0: # should have raised exception earlier - log.error("attribute not found: " + attr_name) + self.log.error("attribute not found: " + attr_name) raise HTTPError(404) responseItem = responseItems[0] for k in responseItem: @@ -1993,7 +1993,7 @@ def put(self): attr_name = self.getRequestName() if attr_name is None: msg = "Bad Request: attribute name not supplied" - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) body = None @@ -2401,7 +2401,7 @@ def post(self): if self.request.uri != '/datasets': msg = "Method not Allowed: invalid datasets post request" - log.info(msg) + self.log.info(msg) raise HTTPError(405, reason=msg) # Method not allowed self.isWritable(self.filePath) @@ -2602,7 +2602,7 @@ def post(self): if self.request.uri != '/datatypes': msg = "Method not Allowed: invalid URI" - log.info(msg) + self.log.info(msg) raise HTTPError(405, reason=msg) # Method not allowed From ee646e6724c56f3d4f3da002bae1e60642ad5244 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:06:56 +0200 Subject: [PATCH 05/10] Bugfix: Add missing import of tornado.ioloop. --- server/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server/app.py b/server/app.py index b1bb0ce..75ddd08 100755 --- a/server/app.py +++ b/server/app.py @@ -23,6 +23,7 @@ import os.path as op import json import tornado.httpserver +import tornado.ioloop import tornado.web import sys import ssl From 034069d6d993789b117c6f0a383238eb6b7a4cd7 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:10:48 +0200 Subject: [PATCH 06/10] Bugfix: Fix unresolved variable. --- server/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.py b/server/app.py index 75ddd08..de7ef2f 100755 --- a/server/app.py +++ b/server/app.py @@ -1584,7 +1584,7 @@ def get(self): self.log.info("values type: " + str(type(values))) else: - msg = "Internal Server Error: unexpected shape class: " + shape['class'] + msg = "Internal Server Error: unexpected shape class: " + item_shape['class'] self.log.error(msg) raise HTTPError(500, reason=msg) From c6f05ad44ca20c6017cdc0e99eca3a46baffb764 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:14:12 +0200 Subject: [PATCH 07/10] Bugfix: Add missing self. --- server/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/app.py b/server/app.py index de7ef2f..afb095e 100755 --- a/server/app.py +++ b/server/app.py @@ -2233,7 +2233,7 @@ def get(self): try: limit = int(limit) except ValueError: - log.info("expected int type for limit") + self.log.info("expected int type for limit") raise HTTPError(400) marker = self.get_query_argument("Marker", None) @@ -2563,7 +2563,7 @@ def get(self): limit = int(limit) except ValueError: msg = "Bad Request: expected int type for Limit" - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) marker = self.get_query_argument("Marker", None) From 4829c2def849f2fa7b935ee2e72ef526c6376fd7 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:27:28 +0200 Subject: [PATCH 08/10] Bugfix: Exceptions do not have method "message". Convert exception e to string class. --- server/app.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/app.py b/server/app.py index afb095e..c819e8b 100755 --- a/server/app.py +++ b/server/app.py @@ -581,7 +581,7 @@ def put(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -908,7 +908,7 @@ def put(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -1136,7 +1136,7 @@ def put(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -1518,7 +1518,7 @@ def get(self): try: limit = int(limit) # convert to int except ValueError as e: - msg = "invalid Limit: " + e.message + msg = "invalid Limit: " + str(e) self.log.info(msg) raise HTTPError(400, msg) @@ -1646,7 +1646,7 @@ def post(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -1737,7 +1737,7 @@ def put(self): body = json_decode(self.request.body) except ValueError as e: try: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) except AttributeError: msg = "JSON Parser Error" self.log.info(msg) @@ -2003,7 +2003,7 @@ def put(self): except ValueError as e: msg = "JSON Parser Error" try: - msg += ": " + e.message + msg += ": " + str(e) except AttributeError: pass # no message property @@ -2283,7 +2283,7 @@ def post(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -2415,7 +2415,7 @@ def post(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) @@ -2613,7 +2613,7 @@ def post(self): try: body = json_decode(self.request.body) except ValueError as e: - msg = "JSON Parser Error: " + e.message + msg = "JSON Parser Error: " + str(e) self.log.info(msg) raise HTTPError(400, reason=msg) From ad6e2604bab721f6b043f7903391f25cf02c113c Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:28:58 +0200 Subject: [PATCH 09/10] Bugfix: Add missing self. --- server/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.py b/server/app.py index c819e8b..0294e0c 100755 --- a/server/app.py +++ b/server/app.py @@ -2463,7 +2463,7 @@ def post(self): pass # can use as is else: msg = "Bad Request: maxdims is invalid" - log.info(msg) + self.log.info(msg) raise HTTPError(400, reason=msg) # validate shape From fe9d4ceadb3966f4fd0bf5fe2f052b5f48970673 Mon Sep 17 00:00:00 2001 From: Rudolf Roedl Date: Wed, 6 Jul 2016 09:51:41 +0200 Subject: [PATCH 10/10] Bugfix: Fix bad indentation. PLEASE CHECK IF THIS IS CORRECT. --- server/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/app.py b/server/app.py index 0294e0c..26fbb17 100755 --- a/server/app.py +++ b/server/app.py @@ -1693,10 +1693,10 @@ def post(self): msg = "Bad Request: elements of points should be list type for datasets of rank >1" self.log.info(msg) raise HTTPError(400, reason=msg) - if len(point) != rank: - msg = "Bad Request: one or more points have a missing coordinate value" - self.log.info(msg) - raise HTTPError(400, reason=msg) + if len(point) != rank: + msg = "Bad Request: one or more points have a missing coordinate value" + self.log.info(msg) + raise HTTPError(400, reason=msg) values = db.getDatasetPointSelectionByUuid(self.reqUuid, points)