meb workflow small corrections

This commit is contained in:
Guille Gutierrez 2024-05-02 15:39:01 +02:00
parent d98674a286
commit 6d4c1437a7

View File

@ -43,7 +43,7 @@ class InselMonthlyEnergyBalance(Resource, Config):
year_of_construction_field=year_of_construction_field, year_of_construction_field=year_of_construction_field,
function_field=function_field, function_field=function_field,
function_to_hub=function_dictionary).city function_to_hub=function_dictionary).city
except TypeError: except KeyError:
return None return None
def _citygml(self, file_path): def _citygml(self, file_path):
@ -58,7 +58,7 @@ class InselMonthlyEnergyBalance(Resource, Config):
function_field=function_field, function_field=function_field,
function_to_hub=function_dictionary, function_to_hub=function_dictionary,
hub_crs=hub_crs).city hub_crs=hub_crs).city
except TypeError: except KeyError:
return None return None
def post(self): def post(self):
@ -77,8 +77,8 @@ class InselMonthlyEnergyBalance(Resource, Config):
tmp_path = (self._tmp_path / token).resolve() tmp_path = (self._tmp_path / token).resolve()
try: try:
os.mkdir(tmp_path) os.mkdir(tmp_path)
except: except FileExistsError:
print('already exist') pass
geometry_file = request.files['geometry_file'] geometry_file = request.files['geometry_file']
if not self._allowed_extensions(geometry_file.filename): if not self._allowed_extensions(geometry_file.filename):
shutil.rmtree(tmp_path) shutil.rmtree(tmp_path)
@ -120,4 +120,4 @@ class InselMonthlyEnergyBalance(Resource, Config):
'yearly_appliances_peak_load': building.appliances_peak_load[cte.YEAR] 'yearly_appliances_peak_load': building.appliances_peak_load[cte.YEAR]
} }
shutil.rmtree(tmp_path) shutil.rmtree(tmp_path)
return Response(json.dumps({'result': 'succeed', 'results': json.dumps(results)}), status=200, headers=response_token) return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=response_token)