|
@@ -148,7 +148,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
#was GetLocalPath
|
|
|
def GetLocalPathFromRelativePath(self,relativePath):
|
|
|
- debug=True
|
|
|
+ debug=False
|
|
|
relativePath=re.sub('labkey://','',relativePath)
|
|
|
sp=os.sep.encode('string-escape')
|
|
|
if debug:
|
|
@@ -162,7 +162,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
#was GetLabkeyPathFromLocalPath
|
|
|
def GetRelativePathFromLocalPath(self,f):
|
|
|
- debug=True
|
|
|
+ debug=False
|
|
|
#report it with URL separator, forward-slash
|
|
|
if f.find(self.localCacheDirectory)<-1:
|
|
|
print("Localpath misformation. Exiting")
|
|
@@ -199,7 +199,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
#standard HTTP
|
|
|
def get(self,url):
|
|
|
|
|
|
- debug=True
|
|
|
+ debug=False
|
|
|
if debug:
|
|
|
print("GET: {0}").format(url)
|
|
|
print("as {0}").format(self.auth_name)
|
|
@@ -216,6 +216,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
def post(self,url,data):
|
|
|
|
|
|
+ debug=False
|
|
|
r=urllib2.Request(url)
|
|
|
#makes it a post
|
|
|
r.add_data(data)
|
|
@@ -226,9 +227,10 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
base64string = base64.b64encode('%s:%s' % (self.auth_name, self.auth_pass))
|
|
|
r.add_header("Authorization", "Basic %s" % base64string)
|
|
|
- print("{}: {}").format(r.get_method(),r.get_full_url())
|
|
|
- print("data: {}").format(r.get_data())
|
|
|
- print("Content-Type: {}").format(r.get_header('Content-Type'))
|
|
|
+ if debug:
|
|
|
+ print("{}: {}").format(r.get_method(),r.get_full_url())
|
|
|
+ print("data: {}").format(r.get_data())
|
|
|
+ print("Content-Type: {}").format(r.get_header('Content-Type'))
|
|
|
try:
|
|
|
return self.opener.open(r)
|
|
|
except urllib2.HTTPError as e:
|
|
@@ -239,7 +241,10 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
def put(self,url,data):
|
|
|
|
|
|
- print("PUT: {}").format(url)
|
|
|
+ debug=False
|
|
|
+
|
|
|
+ if debug:
|
|
|
+ print("PUT: {}").format(url)
|
|
|
r=MethodRequest(url.encode('utf-8'),method="PUT")
|
|
|
#makes it a post
|
|
|
r.add_data(data)
|
|
@@ -508,7 +513,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
return json.load(self.get(url))
|
|
|
|
|
|
def filterDataset(self,project,dataset,filter):
|
|
|
- debug=True
|
|
|
+ debug=False
|
|
|
url=self.GetLabkeyUrl()+'/'+project
|
|
|
url+='/query-selectRows.api?schemaName=study&query.queryName='+dataset
|
|
|
for f in filter:
|
|
@@ -530,7 +535,7 @@ class labkeyURIHandler(slicer.vtkURIHandler):
|
|
|
|
|
|
def filterList(self,project,dataset,filter):
|
|
|
schemaName='lists'
|
|
|
- debug=True
|
|
|
+ debug=False
|
|
|
url=self.GetLabkeyUrl()+'/'+project
|
|
|
url+='/query-selectRows.api?schemaName='+schemaName+'&query.queryName='+dataset
|
|
|
for f in filter:
|