2020# #
2121# ############################################################################################################# #
2222class OutputFileParameter (object ):
23-
23+
2424 def __init__ (self , par_name , d , template_vars_for_param_types = None , wps_execution_shared_dir = None , uploader = None ):
2525 #{"type": "string", "description": "xml OAA output file", "filepath" : "%workdir\\\\output_file.xml" }
2626 self ._name = par_name
@@ -47,7 +47,7 @@ def __init__(self, par_name, d, template_vars_for_param_types=None, wps_executio
4747 for var , val in template_vars_for_param_types .items ():
4848 if var in v :
4949 v = v .replace ("%" + var ,val )
50-
50+
5151 setattr (self , "_" + k , v )
5252
5353 self ._filepath = path .path (self ._filepath )
@@ -66,7 +66,7 @@ def as_json_string(self):
6666 return json .dumps (res )
6767
6868 def get_value (self ):
69- if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir and self ._wps_execution_shared_dir != None :
69+ if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir . lower () is "true" and self ._wps_execution_shared_dir != None :
7070 unique_dirname = str (uuid .uuid4 ())
7171 bkp_dir = path .path (self ._wps_execution_shared_dir + "/" + unique_dirname )
7272 bkp_dir .makedirs ()
@@ -76,7 +76,7 @@ def get_value(self):
7676 dst = path .path (dst )
7777
7878 return dst .text ()
79- elif self ._upload_data != None and self ._upload_data and self ._uploader != None :
79+ elif self ._upload_data != None and self ._upload_data . lower () is "true" and self ._uploader != None :
8080 unique_dirname = str (uuid .uuid4 ())
8181 bkp_dir = path .path (tempfile .gettempdir () + '/' + unique_dirname )
8282 bkp_dir .makedirs ()
@@ -107,7 +107,7 @@ def get_output_mime_type(self):
107107 return self ._output_mime_type
108108
109109 def is_publish_as_layer (self ):
110- return (self ._publish_as_layer != None and self ._publish_as_layer == "true" )
110+ return (self ._publish_as_layer != None and self ._publish_as_layer . lower () is "true" )
111111
112112 def get_publish_layer_name (self ):
113113 return self ._publish_layer_name
@@ -123,7 +123,7 @@ def get_metadata(self):
123123 metadata_file = path .path (self ._publish_metadata )
124124
125125 if metadata_file .isfile ():
126- return metadata_file .text ()
126+ return metadata_file .text ()
127127 return ' '
128128
129129# ############################################################################################################# #
@@ -132,7 +132,7 @@ def get_metadata(self):
132132# #
133133# ############################################################################################################# #
134134class RawFileParameter (object ):
135-
135+
136136 def __init__ (self , par_name , d , template_vars_for_param_types = None , wps_execution_shared_dir = None , uploader = None ):
137137 #{"type": "string", "description": "xml OAA output file", "filepath" : "%workdir\\\\output_file.xml" }
138138 self ._name = par_name
@@ -159,7 +159,7 @@ def __init__(self, par_name, d, template_vars_for_param_types=None, wps_executio
159159 for var , val in template_vars_for_param_types .items ():
160160 if var in v :
161161 v = v .replace ("%" + var ,val )
162-
162+
163163 setattr (self , "_" + k , v )
164164
165165 self ._filepath = path .path (self ._filepath )
@@ -178,7 +178,7 @@ def as_json_string(self):
178178 return json .dumps (res )
179179
180180 def get_value (self ):
181- if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir and self ._wps_execution_shared_dir != None :
181+ if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir . lower () is "true" and self ._wps_execution_shared_dir != None :
182182 unique_dirname = str (uuid .uuid4 ())
183183 bkp_dir = path .path (self ._wps_execution_shared_dir + "/" + unique_dirname )
184184 bkp_dir .makedirs ()
@@ -188,9 +188,9 @@ def get_value(self):
188188 dst = path .path (dst )
189189
190190 return dst
191- elif self ._upload_data != None and self ._upload_data and self ._uploader != None :
191+ elif self ._upload_data != None and self ._upload_data . lower () is "true" and self ._uploader != None :
192192 unique_dirname = str (uuid .uuid4 ())
193-
193+
194194 if self ._upload_data_root :
195195 unique_dirname = self ._upload_data_root + '/' + unique_dirname
196196 src_path = os .path .abspath (os .path .join (self ._filepath .abspath (), os .pardir ))
@@ -215,7 +215,7 @@ def get_output_mime_type(self):
215215 return self ._output_mime_type
216216
217217 def is_publish_as_layer (self ):
218- return (self ._publish_as_layer != None and self ._publish_as_layer == "true" )
218+ return (self ._publish_as_layer != None and self ._publish_as_layer . lower () is "true" )
219219
220220 def get_publish_layer_name (self ):
221221 return self ._publish_layer_name
@@ -231,7 +231,7 @@ def get_metadata(self):
231231 metadata_file = path .path (self ._publish_metadata )
232232
233233 if metadata_file .isfile ():
234- return metadata_file .text ()
234+ return metadata_file .text ()
235235 return ' '
236236
237237
@@ -241,7 +241,7 @@ def get_metadata(self):
241241# #
242242# ############################################################################################################# #
243243class OWCFileParameter (object ):
244-
244+
245245 def __init__ (self , par_name , d , parameters_types_defs , template_vars_for_param_types = None , wps_execution_shared_dir = None , uploader = None ):
246246 #{"type": "string", "description": "xml OAA output file", "filepath" : "%workdir\\\\output_file.xml" }
247247 self ._name = par_name
@@ -267,7 +267,7 @@ def __init__(self, par_name, d, parameters_types_defs, template_vars_for_param_t
267267 for var , val in template_vars_for_param_types .items ():
268268 if var in v :
269269 v = v .replace ("%" + var ,val )
270-
270+
271271 setattr (self , "_" + k , v )
272272
273273 self ._files_to_publish = ''
@@ -307,7 +307,7 @@ def as_json_string(self):
307307 return json .dumps (res )
308308
309309 def get_value (self ):
310- if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir and self ._wps_execution_shared_dir != None :
310+ if self ._backup_on_wps_execution_shared_dir != None and self ._backup_on_wps_execution_shared_dir . lower () is "true" and self ._wps_execution_shared_dir != None :
311311 unique_dirname = str (uuid .uuid4 ())
312312 bkp_dir = path .path (self ._wps_execution_shared_dir + "/" + unique_dirname )
313313 bkp_dir .makedirs ()
@@ -326,7 +326,7 @@ def get_value(self):
326326 files_to_publish = files_to_publish + dst .abspath ()
327327
328328 return files_to_publish
329- elif self ._upload_data != None and self ._upload_data and self ._uploader != None :
329+ elif self ._upload_data != None and self ._upload_data . lower () is "true" and self ._uploader != None :
330330 unique_dirname = str (uuid .uuid4 ())
331331 bkp_dir = path .path (tempfile .gettempdir () + '/' + unique_dirname )
332332 bkp_dir .makedirs ()
@@ -366,7 +366,7 @@ def get_output_mime_type(self):
366366 return self ._output_mime_type
367367
368368 def is_publish_as_layer (self ):
369- return (self ._publish_as_layer != None and self ._publish_as_layer == "true" )
369+ return (self ._publish_as_layer != None and self ._publish_as_layer . lower () is "true" )
370370
371371 def get_publish_layer_name (self ):
372372 return self ._publish_layer_name
@@ -382,5 +382,5 @@ def get_metadata(self):
382382 metadata_file = path .path (self ._publish_metadata )
383383
384384 if metadata_file .isfile ():
385- return metadata_file .text ()
385+ return metadata_file .text ()
386386 return ' '
0 commit comments