Selaa lähdekoodia

Sorting debugging messages

NIX User 5 vuotta sitten
vanhempi
commit
fb7782c55f

+ 4 - 4
labkeySlicerPythonExtension/loadDicom.py

@@ -215,7 +215,7 @@ class loadDicomLogic(slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic):
             f0=localPath
             f1=f0+"1"
             if not dicomModify==None:
-                subprocess.call(dicomModify+" "+f0+" "+f1+" && mv "+f1+" "+f0+";", shell=True)
+                subprocess.call(dicomModify+" "+f0+" "+f1+" && mv "+f1+" "+f0+";", shell=False)
             filelist.append(localPath)
 
         try:
@@ -311,11 +311,11 @@ def isDicom(file):
     return dt=='DICM'
 
 
-def dicomValue(file,tag,seqTag=None):
-    debug=True
+def dicomValue(file,tag,seqTag=None,shell=False):
+    debug=False
     dcmdump=os.path.join(os.environ['SLICER_HOME'],"bin","dcmdump")
     try:
-        out=subprocess.check_output([dcmdump,'+p','+P',tag,file],shell=True)
+        out=subprocess.check_output([dcmdump,'+p','+P',tag,file],shell=shell)
         if debug:
             print("Tag {} Line '{}'").format(tag,out)
         if len(out)==0:

+ 14 - 9
labkeySlicerPythonExtension/slicerNetwork.py

@@ -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: