Merge branch 'develop'
commit
95b3e2d4f9
|
|
@ -32,13 +32,13 @@ def get_energy_category_factor(energy_category_id, start_datetime_utc, end_datet
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_factor is None:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return None
|
||||
else:
|
||||
return rows_factor[0]
|
||||
|
|
@ -72,13 +72,13 @@ def get_energy_item_tariffs(energy_item_id, start_datetime_utc, end_datetime_utc
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_factor is None:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return None
|
||||
else:
|
||||
return rows_factor[0]
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -46,7 +46,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
for row in rows_tariffs:
|
||||
|
|
@ -64,7 +64,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -72,7 +72,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_timeofuse_tariffs is None or len(rows_timeofuse_tariffs) == 0:
|
||||
return dict()
|
||||
|
|
@ -138,7 +138,7 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -147,7 +147,7 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
for row in rows_tariffs:
|
||||
|
|
@ -165,7 +165,7 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -173,7 +173,7 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_timeofuse_tariffs is None or len(rows_timeofuse_tariffs) == 0:
|
||||
return dict()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class CombinedEquipmentCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -112,7 +112,7 @@ class CombinedEquipmentCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.COMBINED_EQUIPMENT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class CombinedEquipmentCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class CombinedEquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(new_id)
|
||||
|
|
@ -186,7 +186,7 @@ class CombinedEquipmentItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -223,7 +223,7 @@ class CombinedEquipmentItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -236,7 +236,7 @@ class CombinedEquipmentItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METER')
|
||||
|
|
@ -249,7 +249,7 @@ class CombinedEquipmentItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METER')
|
||||
|
|
@ -262,7 +262,7 @@ class CombinedEquipmentItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METER')
|
||||
|
|
@ -275,7 +275,7 @@ class CombinedEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ class CombinedEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ class CombinedEquipmentItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.COMBINED_EQUIPMENT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ class CombinedEquipmentItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ class CombinedEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -399,7 +399,7 @@ class CombinedEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ class CombinedEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(new_id)
|
||||
|
||||
|
|
@ -549,7 +549,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -599,7 +599,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -608,7 +608,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
" WHERE id = %s ", (equipment_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
cursor.execute(query, (id_, equipment_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -628,7 +628,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(id_) + '/equipments/' + str(equipment_id)
|
||||
|
|
@ -664,7 +664,7 @@ class CombinedEquipmentEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -673,7 +673,7 @@ class CombinedEquipmentEquipmentItem:
|
|||
" WHERE id = %s ", (eid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ class CombinedEquipmentEquipmentItem:
|
|||
" WHERE combined_equipment_id = %s AND equipment_id = %s ", (id_, eid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_EQUIPMENT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -691,7 +691,7 @@ class CombinedEquipmentEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ class CombinedEquipmentParameterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ class CombinedEquipmentParameterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -899,7 +899,7 @@ class CombinedEquipmentParameterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -908,7 +908,7 @@ class CombinedEquipmentParameterCollection:
|
|||
" WHERE name = %s AND combined_equipment_id = %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.COMBINED_EQUIPMENT_PARAMETER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -924,7 +924,7 @@ class CombinedEquipmentParameterCollection:
|
|||
cursor.execute(query, (point_id, ))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1006,7 +1006,7 @@ class CombinedEquipmentParameterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(id_) + 'parameters/' + str(new_id)
|
||||
|
|
@ -1092,7 +1092,7 @@ class CombinedEquipmentParameterItem:
|
|||
cursor.execute(query, (id_, pid))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -1160,7 +1160,7 @@ class CombinedEquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -1172,7 +1172,7 @@ class CombinedEquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_PARAMETER_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1182,7 +1182,7 @@ class CombinedEquipmentParameterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1262,7 +1262,7 @@ class CombinedEquipmentParameterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1273,7 +1273,7 @@ class CombinedEquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_PARAMETER_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1284,7 +1284,7 @@ class CombinedEquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.COMBINED_EQUIPMENT_PARAMETER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -1301,7 +1301,7 @@ class CombinedEquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1383,7 +1383,7 @@ class CombinedEquipmentParameterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -1412,7 +1412,7 @@ class CombinedEquipmentMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1483,7 +1483,7 @@ class CombinedEquipmentMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1492,7 +1492,7 @@ class CombinedEquipmentMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1502,7 +1502,7 @@ class CombinedEquipmentMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1512,7 +1512,7 @@ class CombinedEquipmentMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -1548,7 +1548,7 @@ class CombinedEquipmentMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1557,7 +1557,7 @@ class CombinedEquipmentMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1566,7 +1566,7 @@ class CombinedEquipmentMeterItem:
|
|||
" WHERE combined_equipment_id = %s AND meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1575,7 +1575,7 @@ class CombinedEquipmentMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1604,7 +1604,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1675,7 +1675,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1684,7 +1684,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1694,7 +1694,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1705,7 +1705,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -1741,7 +1741,7 @@ class CombinedEquipmentOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1750,7 +1750,7 @@ class CombinedEquipmentOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1759,7 +1759,7 @@ class CombinedEquipmentOfflineMeterItem:
|
|||
" WHERE combined_equipment_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1768,7 +1768,7 @@ class CombinedEquipmentOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1797,7 +1797,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1868,7 +1868,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1877,7 +1877,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1887,7 +1887,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1898,7 +1898,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/combinedequipments/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -1934,7 +1934,7 @@ class CombinedEquipmentVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1943,7 +1943,7 @@ class CombinedEquipmentVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1952,7 +1952,7 @@ class CombinedEquipmentVirtualMeterItem:
|
|||
" WHERE combined_equipment_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1961,6 +1961,6 @@ class CombinedEquipmentVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ContactCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -97,7 +97,7 @@ class ContactCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.CONTACT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ class ContactCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/contacts/' + str(new_id)
|
||||
|
|
@ -144,7 +144,7 @@ class ContactItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -174,7 +174,7 @@ class ContactItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ class ContactItem:
|
|||
rows_shopfloors = cursor.fetchall()
|
||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -197,7 +197,7 @@ class ContactItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -209,7 +209,7 @@ class ContactItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -221,7 +221,7 @@ class ContactItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -230,7 +230,7 @@ class ContactItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ class ContactItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ class ContactItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.CONTACT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -316,7 +316,7 @@ class ContactItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CostCenterCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -71,7 +71,7 @@ class CostCenterCollection:
|
|||
" WHERE name = %s ", (name, ))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.COST_CENTER_NAME_EXISTS')
|
||||
|
|
@ -81,7 +81,7 @@ class CostCenterCollection:
|
|||
" WHERE external_id = %s ", (external_id, ))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.COST_CENTER_EXTERNAL_ID_EXISTS')
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class CostCenterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/costcenters/' + str(new_id)
|
||||
|
|
@ -126,7 +126,7 @@ class CostCenterItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -152,7 +152,7 @@ class CostCenterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ class CostCenterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -175,7 +175,7 @@ class CostCenterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -187,7 +187,7 @@ class CostCenterItem:
|
|||
rows_tariffs = cursor.fetchall()
|
||||
if rows_tariffs is not None and len(rows_tariffs) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TARIFFS')
|
||||
|
|
@ -199,7 +199,7 @@ class CostCenterItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -211,7 +211,7 @@ class CostCenterItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -223,7 +223,7 @@ class CostCenterItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -235,7 +235,7 @@ class CostCenterItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -247,7 +247,7 @@ class CostCenterItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -259,7 +259,7 @@ class CostCenterItem:
|
|||
rows_factories = cursor.fetchall()
|
||||
if rows_factories is not None and len(rows_factories) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -271,7 +271,7 @@ class CostCenterItem:
|
|||
rows_shopfloors = cursor.fetchall()
|
||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -280,7 +280,7 @@ class CostCenterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -319,7 +319,7 @@ class CostCenterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ class CostCenterItem:
|
|||
(name, id_, ))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.COST_CENTER_NAME_EXISTS')
|
||||
|
|
@ -340,7 +340,7 @@ class CostCenterItem:
|
|||
(external_id, id_, ))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.COST_CENTER_EXTERNAL_ID_EXISTS')
|
||||
|
|
@ -350,7 +350,7 @@ class CostCenterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
|
@ -365,7 +365,7 @@ class CostCenterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -399,7 +399,7 @@ class CostCenterTariffCollection:
|
|||
rows = cursor.fetchall()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -437,7 +437,7 @@ class CostCenterTariffCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ class CostCenterTariffCollection:
|
|||
" WHERE id = %s ", (new_values['data']['tariff_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_NOT_FOUND')
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ class CostCenterTariffCollection:
|
|||
rows = cursor.fetchall()
|
||||
if rows is not None and len(rows) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_IS_ALREADY_ASSOCIATED_WITH_COST_CENTER')
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ class CostCenterTariffCollection:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/costcenters/' + str(id_) + '/tariffs/' + str(new_values['data']['tariff_id'])
|
||||
|
|
@ -504,7 +504,7 @@ class CostCenterTariffItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ class CostCenterTariffItem:
|
|||
" WHERE id = %s ", (tid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_NOT_FOUND')
|
||||
|
||||
|
|
@ -522,7 +522,7 @@ class CostCenterTariffItem:
|
|||
" WHERE cost_center_id = %s AND tariff_id = %s ", (id_, tid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_IS_NOT_ASSOCIATED_WITH_COST_CENTER')
|
||||
|
||||
|
|
@ -531,6 +531,6 @@ class CostCenterTariffItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class CostFileCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -102,7 +102,7 @@ class CostFileCollection:
|
|||
if cursor_user_db:
|
||||
cursor_user_db.close()
|
||||
if cnx_user_db:
|
||||
cnx_user_db.disconnect()
|
||||
cnx_user_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -111,7 +111,7 @@ class CostFileCollection:
|
|||
if cursor_user_db:
|
||||
cursor_user_db.close()
|
||||
if cnx_user_db:
|
||||
cnx_user_db.disconnect()
|
||||
cnx_user_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class CostFileCollection:
|
|||
if cursor_user_db:
|
||||
cursor_user_db.close()
|
||||
if cnx_user_db:
|
||||
cnx_user_db.disconnect()
|
||||
cnx_user_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ class CostFileCollection:
|
|||
new_id = cursor_historical_db.lastrowid
|
||||
cnx_historical_db.commit()
|
||||
cursor_historical_db.close()
|
||||
cnx_historical_db.disconnect()
|
||||
cnx_historical_db.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/costfiles/' + str(new_id)
|
||||
|
|
@ -176,7 +176,7 @@ class CostFileItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_FILE_NOT_FOUND')
|
||||
|
|
@ -211,7 +211,7 @@ class CostFileItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_FILE_NOT_FOUND')
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ class CostFileItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ class CostFileRestore:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DataSourceCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -132,7 +132,7 @@ class DataSourceCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.DATA_SOURCE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class DataSourceCollection:
|
|||
" WHERE id = %s ", (gateway_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_GATEWAY_ID')
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ class DataSourceCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/datasources/' + str(new_id)
|
||||
|
|
@ -198,7 +198,7 @@ class DataSourceItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DATA_SOURCE_NOT_FOUND')
|
||||
|
|
@ -241,7 +241,7 @@ class DataSourceItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DATA_SOURCE_NOT_FOUND')
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ class DataSourceItem:
|
|||
row_meter = cursor.fetchone()
|
||||
if row_meter is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THIS_DATA_SOURCE_IS_BEING_USED_BY_A_METER' + row_meter[0])
|
||||
|
|
@ -265,7 +265,7 @@ class DataSourceItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -336,7 +336,7 @@ class DataSourceItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DATA_SOURCE_NOT_FOUND')
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ class DataSourceItem:
|
|||
" WHERE id = %s ", (gateway_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_GATEWAY_ID')
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ class DataSourceItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ class DataSourcePointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DATA_SOURCE_NOT_FOUND')
|
||||
|
||||
|
|
@ -421,5 +421,5 @@ class DataSourcePointCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class DistributionCircuitCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -136,7 +136,7 @@ class DistributionCircuitCollection:
|
|||
(distribution_system_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_SYSTEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ class DistributionCircuitCollection:
|
|||
(distribution_system_id, name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ class DistributionCircuitCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/distributioncircuits/' + str(new_id)
|
||||
|
|
@ -210,7 +210,7 @@ class DistributionCircuitItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -245,7 +245,7 @@ class DistributionCircuitItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NOT_FOUND')
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ class DistributionCircuitItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ class DistributionCircuitItem:
|
|||
(distribution_system_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_SYSTEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ class DistributionCircuitItem:
|
|||
(distribution_system_id, name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ class DistributionCircuitItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -414,7 +414,7 @@ class DistributionCircuitPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NOT_FOUND')
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ class DistributionCircuitPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NOT_FOUND')
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ class DistributionCircuitPointCollection:
|
|||
" WHERE id = %s ", (new_values['data']['point_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ class DistributionCircuitPointCollection:
|
|||
cursor.execute(query, (id_, new_values['data']['point_id'],))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.DISTRIBUTION_CIRCUIT_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -492,7 +492,7 @@ class DistributionCircuitPointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/distributioncircuits/' + str(id_) + '/points/' + str(new_values['data']['point_id'])
|
||||
|
|
@ -528,7 +528,7 @@ class DistributionCircuitPointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_CIRCUIT_NOT_FOUND')
|
||||
|
||||
|
|
@ -537,7 +537,7 @@ class DistributionCircuitPointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ class DistributionCircuitPointItem:
|
|||
" WHERE distribution_circuit_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_CIRCUIT_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ class DistributionCircuitPointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DistributionSystemCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -84,7 +84,7 @@ class DistributionSystemCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.DISTRIBUTION_SYSTEM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ class DistributionSystemCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/distributionsystems/' + str(new_id)
|
||||
|
|
@ -130,7 +130,7 @@ class DistributionSystemItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -159,7 +159,7 @@ class DistributionSystemItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_SYSTEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ class DistributionSystemItem:
|
|||
rows_distribution_circuits = cursor.fetchall()
|
||||
if rows_distribution_circuits is not None and len(rows_distribution_circuits) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_ASSOCIATED_DISTRIBUTION_CIRCUITS')
|
||||
|
|
@ -180,7 +180,7 @@ class DistributionSystemItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ class DistributionSystemItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.DISTRIBUTION_SYSTEM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class DistributionSystemItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ class DistributionSystemDistributionCircuitCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_SYSTEM_NOT_FOUND')
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class EmailMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -211,7 +211,7 @@ class EmailMessageCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ class EmailMessageCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/emailmessages/' + str(new_id)
|
||||
|
|
@ -271,7 +271,7 @@ class EmailMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -416,7 +416,7 @@ class EmailMessageItem:
|
|||
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EMAIL_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -428,7 +428,7 @@ class EmailMessageItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -452,7 +452,7 @@ class EmailMessageItem:
|
|||
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ class EmailMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EMAIL_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -486,6 +486,6 @@ class EmailMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class EmailServerCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -118,7 +118,7 @@ class EmailServerCollection:
|
|||
" WHERE host = %s ", (host,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.EMAIL_SERVER_HOST_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ class EmailServerCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/emailservers/' + str(new_id)
|
||||
|
|
@ -165,7 +165,7 @@ class EmailServerItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND')
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class EmailServerItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EMAIL_SERVER_NOT_FOUND')
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ class EmailServerItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ class EmailServerItem:
|
|||
(id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EMAIL_SERVER_NOT_FOUND')
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ class EmailServerItem:
|
|||
" WHERE host = %s AND id != %s ", (host, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.EMAIL_SERVER_HOST_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -312,6 +312,6 @@ class EmailServerItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class EnergyCategoryCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -88,7 +88,7 @@ class EnergyCategoryCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class EnergyCategoryCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/energycategories/' + str(new_id)
|
||||
|
|
@ -134,7 +134,7 @@ class EnergyCategoryItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -163,7 +163,7 @@ class EnergyCategoryItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ class EnergyCategoryItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_USED_IN_METER')
|
||||
|
|
@ -184,7 +184,7 @@ class EnergyCategoryItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_USED_IN_VIRTUAL_METER')
|
||||
|
|
@ -195,7 +195,7 @@ class EnergyCategoryItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_USED_IN_OFFLINE_METER')
|
||||
|
|
@ -206,7 +206,7 @@ class EnergyCategoryItem:
|
|||
rows_tariffs = cursor.fetchall()
|
||||
if rows_tariffs is not None and len(rows_tariffs) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_USED_IN_TARIFFS')
|
||||
|
|
@ -217,7 +217,7 @@ class EnergyCategoryItem:
|
|||
rows_energy_items = cursor.fetchall()
|
||||
if rows_energy_items is not None and len(rows_energy_items) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_USED_IN_ENERGY_ITEMS')
|
||||
|
|
@ -226,7 +226,7 @@ class EnergyCategoryItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -282,7 +282,7 @@ class EnergyCategoryItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ class EnergyCategoryItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_CATEGORY_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -305,5 +305,5 @@ class EnergyCategoryItem:
|
|||
id_,))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_200
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class EnergyFlowDiagramCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -147,7 +147,7 @@ class EnergyFlowDiagramCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class EnergyFlowDiagramCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/energyflowdiagrams/' + str(new_id)
|
||||
|
|
@ -268,7 +268,7 @@ class EnergyFlowDiagramItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -309,7 +309,7 @@ class EnergyFlowDiagramItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ class EnergyFlowDiagramItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ class EnergyFlowDiagramItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ class EnergyFlowDiagramItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -522,7 +522,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_LINK_IS_ALREADY_IN_USE')
|
||||
|
|
@ -545,7 +545,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
cursor.execute(query, (source_node_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.SOURCE_NODE_NOT_FOUND')
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
cursor.execute(query, (target_node_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARGET_NODE_NOT_FOUND')
|
||||
|
||||
|
|
@ -615,7 +615,7 @@ class EnergyFlowDiagramLinkCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/energyflowdiagrams/' + str(id_) + 'links/' + str(new_id)
|
||||
|
|
@ -700,7 +700,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
cursor.execute(query, (id_, lid))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -743,7 +743,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
|
@ -755,7 +755,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_LINK_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -765,7 +765,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -820,7 +820,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -831,7 +831,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_LINK_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -844,7 +844,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_LINK_IS_ALREADY_IN_USE')
|
||||
|
|
@ -855,7 +855,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
cursor.execute(query, (source_node_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.SOURCE_NODE_NOT_FOUND')
|
||||
|
||||
|
|
@ -865,7 +865,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
cursor.execute(query, (target_node_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARGET_NODE_NOT_FOUND')
|
||||
|
||||
|
|
@ -925,7 +925,7 @@ class EnergyFlowDiagramLinkItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -954,7 +954,7 @@ class EnergyFlowDiagramNodeCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ class EnergyFlowDiagramNodeCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -1006,7 +1006,7 @@ class EnergyFlowDiagramNodeCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -1015,7 +1015,7 @@ class EnergyFlowDiagramNodeCollection:
|
|||
" WHERE name = %s AND energy_flow_diagram_id = %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -1027,7 +1027,7 @@ class EnergyFlowDiagramNodeCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/energyflowdiagrams/' + str(id_) + 'nodes/' + str(new_id)
|
||||
|
|
@ -1062,7 +1062,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
cursor.execute(query, (id_, nid))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -1095,7 +1095,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
|
@ -1107,7 +1107,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NODE_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1117,7 +1117,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1156,7 +1156,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
|
||||
|
|
@ -1167,7 +1167,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NODE_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1178,7 +1178,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NODE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -1190,7 +1190,7 @@ class EnergyFlowDiagramNodeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class EnergyItemCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -85,7 +85,7 @@ class EnergyItemCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ class EnergyItemCollection:
|
|||
(energy_category_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class EnergyItemCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/energyitems/' + str(new_id)
|
||||
|
|
@ -151,7 +151,7 @@ class EnergyItemItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -179,7 +179,7 @@ class EnergyItemItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ class EnergyItemItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_USED_IN_METER')
|
||||
|
|
@ -200,7 +200,7 @@ class EnergyItemItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_USED_IN_VIRTUAL_METER')
|
||||
|
|
@ -211,7 +211,7 @@ class EnergyItemItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_USED_IN_OFFLINE_METER')
|
||||
|
|
@ -220,7 +220,7 @@ class EnergyItemItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -259,7 +259,7 @@ class EnergyItemItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ class EnergyItemItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ class EnergyItemItem:
|
|||
(energy_category_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -290,6 +290,6 @@ class EnergyItemItem:
|
|||
id_,))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class EquipmentCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -112,7 +112,7 @@ class EquipmentCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.EQUIPMENT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class EquipmentCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class EquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(new_id)
|
||||
|
|
@ -186,7 +186,7 @@ class EquipmentItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -224,7 +224,7 @@ class EquipmentItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -237,7 +237,7 @@ class EquipmentItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -250,7 +250,7 @@ class EquipmentItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METER')
|
||||
|
|
@ -263,7 +263,7 @@ class EquipmentItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METER')
|
||||
|
|
@ -276,7 +276,7 @@ class EquipmentItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METER')
|
||||
|
|
@ -289,7 +289,7 @@ class EquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ class EquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ class EquipmentItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.EQUIPMENT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ class EquipmentItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -386,7 +386,7 @@ class EquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ class EquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -531,7 +531,7 @@ class EquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(new_id)
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ class EquipmentParameterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ class EquipmentParameterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -739,7 +739,7 @@ class EquipmentParameterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -748,7 +748,7 @@ class EquipmentParameterCollection:
|
|||
" WHERE name = %s AND equipment_id = %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.EQUIPMENT_PARAMETER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -764,7 +764,7 @@ class EquipmentParameterCollection:
|
|||
cursor.execute(query, (point_id, ))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -846,7 +846,7 @@ class EquipmentParameterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(id_) + 'parameters/' + str(new_id)
|
||||
|
|
@ -933,7 +933,7 @@ class EquipmentParameterItem:
|
|||
cursor.execute(query, (id_, pid))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -1001,7 +1001,7 @@ class EquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -1013,7 +1013,7 @@ class EquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_PARAMETER_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1023,7 +1023,7 @@ class EquipmentParameterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1103,7 +1103,7 @@ class EquipmentParameterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1114,7 +1114,7 @@ class EquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_PARAMETER_NOT_FOUND_OR_NOT_MATCH')
|
||||
|
|
@ -1125,7 +1125,7 @@ class EquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.EQUIPMENT_PARAMETER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -1142,7 +1142,7 @@ class EquipmentParameterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1224,7 +1224,7 @@ class EquipmentParameterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -1253,7 +1253,7 @@ class EquipmentMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1325,7 +1325,7 @@ class EquipmentMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1334,7 +1334,7 @@ class EquipmentMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1344,7 +1344,7 @@ class EquipmentMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1354,7 +1354,7 @@ class EquipmentMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -1390,7 +1390,7 @@ class EquipmentMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1399,7 +1399,7 @@ class EquipmentMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1408,7 +1408,7 @@ class EquipmentMeterItem:
|
|||
" WHERE equipment_id = %s AND meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1416,7 +1416,7 @@ class EquipmentMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1445,7 +1445,7 @@ class EquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1516,7 +1516,7 @@ class EquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1525,7 +1525,7 @@ class EquipmentOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1535,7 +1535,7 @@ class EquipmentOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1545,7 +1545,7 @@ class EquipmentOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -1581,7 +1581,7 @@ class EquipmentOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1590,7 +1590,7 @@ class EquipmentOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1599,7 +1599,7 @@ class EquipmentOfflineMeterItem:
|
|||
" WHERE equipment_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1608,7 +1608,7 @@ class EquipmentOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1637,7 +1637,7 @@ class EquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1708,7 +1708,7 @@ class EquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1717,7 +1717,7 @@ class EquipmentVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1727,7 +1727,7 @@ class EquipmentVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1737,7 +1737,7 @@ class EquipmentVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/equipments/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -1773,7 +1773,7 @@ class EquipmentVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1782,7 +1782,7 @@ class EquipmentVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1791,7 +1791,7 @@ class EquipmentVirtualMeterItem:
|
|||
" WHERE equipment_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1800,6 +1800,6 @@ class EquipmentVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class GatewayCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -79,7 +79,7 @@ class GatewayCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.GATEWAY_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class GatewayCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/gateways/' + str(new_id)
|
||||
|
|
@ -123,7 +123,7 @@ class GatewayItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.GATEWAY_NOT_FOUND')
|
||||
|
|
@ -163,7 +163,7 @@ class GatewayItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.GATEWAY_NOT_FOUND')
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class GatewayItem:
|
|||
(id_,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_DATA_SOURCES')
|
||||
|
|
@ -184,7 +184,7 @@ class GatewayItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -218,7 +218,7 @@ class GatewayItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.GATEWAY_NOT_FOUND')
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ class GatewayItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.GATEWAY_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ class GatewayItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ class GatewayDataSourceCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.GATEWAY_NOT_FOUND')
|
||||
|
||||
|
|
@ -303,6 +303,6 @@ class GatewayDataSourceCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class KnowledgeFileCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
user_dict = dict()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -46,7 +46,7 @@ class KnowledgeFileCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -124,7 +124,7 @@ class KnowledgeFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -133,7 +133,7 @@ class KnowledgeFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ class KnowledgeFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -166,7 +166,7 @@ class KnowledgeFileCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/knowledgefiles/' + str(new_id)
|
||||
|
|
@ -196,7 +196,7 @@ class KnowledgeFileItem:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
user_dict = dict()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -212,7 +212,7 @@ class KnowledgeFileItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -250,7 +250,7 @@ class KnowledgeFileItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.KNOWLEDGE_FILE_NOT_FOUND')
|
||||
|
|
@ -269,7 +269,7 @@ class KnowledgeFileItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ class KnowledgeFileRestore:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class MenuCollection:
|
|||
result.append(temp)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class MenuItem:
|
|||
"is_hidden": bool(rows_menu['is_hidden'])}
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -111,7 +111,7 @@ class MenuItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ class MenuChildrenCollection:
|
|||
row_current_menu = cursor.fetchone()
|
||||
if row_current_menu is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.MENU_NOT_FOUND')
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ class MenuChildrenCollection:
|
|||
result['children'].append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
||||
|
|
@ -233,5 +233,5 @@ class MenuWebCollection:
|
|||
result[item['route']] = item['children']
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class MeterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -189,7 +189,7 @@ class MeterCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ class MeterCollection:
|
|||
(new_values['data']['energy_category_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ class MeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -222,13 +222,13 @@ class MeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_DOES_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -240,13 +240,13 @@ class MeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.MASTER_METER_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ class MeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/meters/' + str(new_id)
|
||||
|
|
@ -348,7 +348,7 @@ class MeterItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -390,7 +390,7 @@ class MeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -404,7 +404,7 @@ class MeterItem:
|
|||
row_virtual_meter = cursor.fetchone()
|
||||
if row_virtual_meter is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THIS_METER_IS_BEING_USED_BY_A_VIRTUAL_METER')
|
||||
|
|
@ -416,7 +416,7 @@ class MeterItem:
|
|||
rows_child_meters = cursor.fetchall()
|
||||
if rows_child_meters is not None and len(rows_child_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_CHILD_METERS')
|
||||
|
|
@ -428,7 +428,7 @@ class MeterItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -440,7 +440,7 @@ class MeterItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -452,7 +452,7 @@ class MeterItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -464,7 +464,7 @@ class MeterItem:
|
|||
rows_shopfloors = cursor.fetchall()
|
||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -477,7 +477,7 @@ class MeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -489,7 +489,7 @@ class MeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -501,7 +501,7 @@ class MeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -513,7 +513,7 @@ class MeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -525,7 +525,7 @@ class MeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -537,7 +537,7 @@ class MeterItem:
|
|||
rows_links = cursor.fetchall()
|
||||
if rows_links is not None and len(rows_links) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_ENERGY_FLOW_DIAGRAM_LINKS')
|
||||
|
|
@ -546,7 +546,7 @@ class MeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ class MeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ class MeterItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ class MeterItem:
|
|||
(new_values['data']['energy_category_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -673,7 +673,7 @@ class MeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -685,13 +685,13 @@ class MeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_DOES_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -703,13 +703,13 @@ class MeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.MASTER_METER_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -722,7 +722,7 @@ class MeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CANNOT_SET_EXISTING_SUBMETER_AS_MASTER_METER')
|
||||
|
||||
|
|
@ -744,7 +744,7 @@ class MeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -774,7 +774,7 @@ class MeterSubmeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -847,7 +847,7 @@ class MeterSubmeterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
||||
|
|
@ -875,7 +875,7 @@ class MeterPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -921,7 +921,7 @@ class MeterPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
cursor.execute(" SELECT name, object_type "
|
||||
|
|
@ -930,7 +930,7 @@ class MeterPointCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
elif row[1] == 'ENERGY_VALUE':
|
||||
|
|
@ -941,7 +941,7 @@ class MeterPointCollection:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS')
|
||||
|
||||
|
|
@ -951,7 +951,7 @@ class MeterPointCollection:
|
|||
cursor.execute(query, (id_, new_values['data']['point_id'],))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.METER_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -961,7 +961,7 @@ class MeterPointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/meters/' + str(id_) + '/points/' + str(new_values['data']['point_id'])
|
||||
|
|
@ -998,7 +998,7 @@ class MeterPointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1007,7 +1007,7 @@ class MeterPointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1016,7 +1016,7 @@ class MeterPointItem:
|
|||
" WHERE meter_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1024,7 +1024,7 @@ class MeterPointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class NotificationCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -89,7 +89,7 @@ class NotificationCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ class NotificationCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -130,7 +130,7 @@ class NotificationCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -188,7 +188,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -197,7 +197,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -226,7 +226,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -289,7 +289,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -298,7 +298,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -324,7 +324,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.NOTIFICATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -380,7 +380,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -393,7 +393,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -408,7 +408,7 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.NOTIFICATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -417,6 +417,6 @@ class NotificationItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class OfflineMeterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -166,7 +166,7 @@ class OfflineMeterCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.OFFLINE_METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ class OfflineMeterCollection:
|
|||
(new_values['data']['energy_category_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
if energy_item_id is not None:
|
||||
|
|
@ -187,13 +187,13 @@ class OfflineMeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_IS_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ class OfflineMeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ class OfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/offlinemeters/' + str(new_id)
|
||||
|
|
@ -294,7 +294,7 @@ class OfflineMeterItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -333,7 +333,7 @@ class OfflineMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -347,7 +347,7 @@ class OfflineMeterItem:
|
|||
row_virtual_meter = cursor.fetchone()
|
||||
if row_virtual_meter is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THIS_OFFLINE_METER_IS_BEING_USED_BY_A_VIRTUAL_METER')
|
||||
|
|
@ -359,7 +359,7 @@ class OfflineMeterItem:
|
|||
rows_companies = cursor.fetchall()
|
||||
if rows_companies is not None and len(rows_companies) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -372,7 +372,7 @@ class OfflineMeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -385,7 +385,7 @@ class OfflineMeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -397,7 +397,7 @@ class OfflineMeterItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -409,7 +409,7 @@ class OfflineMeterItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -421,7 +421,7 @@ class OfflineMeterItem:
|
|||
rows_shopfloors = cursor.fetchall()
|
||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -433,7 +433,7 @@ class OfflineMeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -446,7 +446,7 @@ class OfflineMeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -458,7 +458,7 @@ class OfflineMeterItem:
|
|||
rows_links = cursor.fetchall()
|
||||
if rows_links is not None and len(rows_links) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_ENERGY_FLOW_DIAGRAM_LINKS')
|
||||
|
|
@ -467,7 +467,7 @@ class OfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -554,7 +554,7 @@ class OfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -563,7 +563,7 @@ class OfflineMeterItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.OFFLINE_METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -573,7 +573,7 @@ class OfflineMeterItem:
|
|||
(new_values['data']['energy_category_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ class OfflineMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -596,13 +596,13 @@ class OfflineMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_IS_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ class OfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class OfflineMeterFileCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -101,7 +101,7 @@ class OfflineMeterFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -110,7 +110,7 @@ class OfflineMeterFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class OfflineMeterFileCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -143,7 +143,7 @@ class OfflineMeterFileCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/offlinemeterfiles/' + str(new_id)
|
||||
|
|
@ -176,7 +176,7 @@ class OfflineMeterFileItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_FILE_NOT_FOUND')
|
||||
|
|
@ -211,7 +211,7 @@ class OfflineMeterFileItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_FILE_NOT_FOUND')
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ class OfflineMeterFileItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ class OfflineMeterFileRestore:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class PointCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -160,7 +160,7 @@ class PointCollection:
|
|||
" WHERE name = %s AND data_source_id = %s ", (name, data_source_id))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ class PointCollection:
|
|||
" WHERE id = %s ", (data_source_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_DATA_SOURCE_ID')
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ class PointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/points/' + str(new_id)
|
||||
|
|
@ -237,7 +237,7 @@ class PointItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
|
@ -273,7 +273,7 @@ class PointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ class PointItem:
|
|||
row_meter = cursor.fetchone()
|
||||
if row_meter is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -300,7 +300,7 @@ class PointItem:
|
|||
row_sensor = cursor.fetchone()
|
||||
if row_sensor is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
|
@ -314,7 +314,7 @@ class PointItem:
|
|||
row_shopfloor = cursor.fetchone()
|
||||
if row_shopfloor is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -328,7 +328,7 @@ class PointItem:
|
|||
row_store = cursor.fetchone()
|
||||
if row_store is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -342,7 +342,7 @@ class PointItem:
|
|||
row_space = cursor.fetchone()
|
||||
if row_space is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -356,7 +356,7 @@ class PointItem:
|
|||
row_tenant = cursor.fetchone()
|
||||
if row_tenant is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -370,7 +370,7 @@ class PointItem:
|
|||
row_equipment = cursor.fetchone()
|
||||
if row_equipment is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -384,7 +384,7 @@ class PointItem:
|
|||
row_combined_equipment = cursor.fetchone()
|
||||
if row_combined_equipment is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -393,7 +393,7 @@ class PointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -499,7 +499,7 @@ class PointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ class PointItem:
|
|||
" WHERE id = %s ", (data_source_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_DATA_SOURCE_ID')
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ class PointItem:
|
|||
" WHERE name = %s AND data_source_id = %s AND id != %s ", (name, data_source_id, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.POINT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ class PointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class PrivilegeCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -71,7 +71,7 @@ class PrivilegeCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.PRIVILEGE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class PrivilegeCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/privileges/' + str(new_id)
|
||||
|
|
@ -117,7 +117,7 @@ class PrivilegeItem:
|
|||
rows_users = cursor.fetchall()
|
||||
if rows_users is not None and len(rows_users) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_USERS')
|
||||
|
|
@ -127,7 +127,7 @@ class PrivilegeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PRIVILEGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ class PrivilegeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ class PrivilegeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PRIVILEGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ class PrivilegeItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.PRIVILEGE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class PrivilegeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class RuleCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -159,7 +159,7 @@ class RuleCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.RULE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ class RuleCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/rules/' + str(new_id)
|
||||
|
|
@ -215,7 +215,7 @@ class RuleItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
|
@ -265,7 +265,7 @@ class RuleItem:
|
|||
(id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ class RuleItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ class RuleItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ class RuleItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.RULE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -402,6 +402,6 @@ class RuleItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class SensorCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -74,7 +74,7 @@ class SensorCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.SENSOR_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class SensorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/sensors/' + str(new_id)
|
||||
|
|
@ -118,7 +118,7 @@ class SensorItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -147,7 +147,7 @@ class SensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ class SensorItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -170,7 +170,7 @@ class SensorItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -182,7 +182,7 @@ class SensorItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -194,7 +194,7 @@ class SensorItem:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -203,7 +203,7 @@ class SensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ class SensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ class SensorItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.SENSOR_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ class SensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ class SensorPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ class SensorPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ class SensorPointCollection:
|
|||
" WHERE id = %s ", (new_values['data']['point_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ class SensorPointCollection:
|
|||
cursor.execute(query, (id_, new_values['data']['point_id'],))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SENSOR_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ class SensorPointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/sensors/' + str(id_) + '/points/' + str(new_values['data']['point_id'])
|
||||
|
|
@ -408,7 +408,7 @@ class SensorPointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ class SensorPointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ class SensorPointItem:
|
|||
" WHERE sensor_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ class SensorPointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class ShopfloorCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -137,7 +137,7 @@ class ShopfloorCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.SHOPFLOOR_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ class ShopfloorCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ class ShopfloorCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ class ShopfloorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(new_id)
|
||||
|
|
@ -235,7 +235,7 @@ class ShopfloorItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -274,7 +274,7 @@ class ShopfloorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ class ShopfloorItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -299,7 +299,7 @@ class ShopfloorItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -312,7 +312,7 @@ class ShopfloorItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -325,7 +325,7 @@ class ShopfloorItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -337,7 +337,7 @@ class ShopfloorItem:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -350,7 +350,7 @@ class ShopfloorItem:
|
|||
rows_sensors = cursor.fetchall()
|
||||
if rows_sensors is not None and len(rows_sensors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
|
@ -363,7 +363,7 @@ class ShopfloorItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METERS')
|
||||
|
|
@ -372,7 +372,7 @@ class ShopfloorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ class ShopfloorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ class ShopfloorItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.SHOPFLOOR_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ class ShopfloorItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ class ShopfloorItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ class ShopfloorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -524,7 +524,7 @@ class ShopfloorEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ class ShopfloorEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -583,7 +583,7 @@ class ShopfloorEquipmentCollection:
|
|||
" WHERE id = %s ", (equipment_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -593,7 +593,7 @@ class ShopfloorEquipmentCollection:
|
|||
cursor.execute(query, (id_, equipment_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -603,7 +603,7 @@ class ShopfloorEquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/equipments/' + str(equipment_id)
|
||||
|
|
@ -639,7 +639,7 @@ class ShopfloorEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -648,7 +648,7 @@ class ShopfloorEquipmentItem:
|
|||
" WHERE id = %s ", (eid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -657,7 +657,7 @@ class ShopfloorEquipmentItem:
|
|||
" WHERE shopfloor_id = %s AND equipment_id = %s ", (id_, eid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_EQUIPMENT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -666,7 +666,7 @@ class ShopfloorEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ class ShopfloorMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ class ShopfloorMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -768,7 +768,7 @@ class ShopfloorMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -778,7 +778,7 @@ class ShopfloorMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -788,7 +788,7 @@ class ShopfloorMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -824,7 +824,7 @@ class ShopfloorMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ class ShopfloorMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -842,7 +842,7 @@ class ShopfloorMeterItem:
|
|||
" WHERE shopfloor_id = %s AND meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -850,7 +850,7 @@ class ShopfloorMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -879,7 +879,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -943,7 +943,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -952,7 +952,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -962,7 +962,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -972,7 +972,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -1008,7 +1008,7 @@ class ShopfloorOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1017,7 +1017,7 @@ class ShopfloorOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ class ShopfloorOfflineMeterItem:
|
|||
" WHERE shopfloor_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1035,7 +1035,7 @@ class ShopfloorOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1064,7 +1064,7 @@ class ShopfloorPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1127,7 +1127,7 @@ class ShopfloorPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1136,7 +1136,7 @@ class ShopfloorPointCollection:
|
|||
" WHERE id = %s ", (point_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1146,7 +1146,7 @@ class ShopfloorPointCollection:
|
|||
cursor.execute(query, (id_, point_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1156,7 +1156,7 @@ class ShopfloorPointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/points/' + str(point_id)
|
||||
|
|
@ -1192,7 +1192,7 @@ class ShopfloorPointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1201,7 +1201,7 @@ class ShopfloorPointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1210,7 +1210,7 @@ class ShopfloorPointItem:
|
|||
" WHERE shopfloor_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1219,7 +1219,7 @@ class ShopfloorPointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1248,7 +1248,7 @@ class ShopfloorSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1298,7 +1298,7 @@ class ShopfloorSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1307,7 +1307,7 @@ class ShopfloorSensorCollection:
|
|||
" WHERE id = %s ", (sensor_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ class ShopfloorSensorCollection:
|
|||
cursor.execute(query, (id_, sensor_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_SENSOR_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1327,7 +1327,7 @@ class ShopfloorSensorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/sensors/' + str(sensor_id)
|
||||
|
|
@ -1363,7 +1363,7 @@ class ShopfloorSensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1372,7 +1372,7 @@ class ShopfloorSensorItem:
|
|||
" WHERE id = %s ", (sid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ class ShopfloorSensorItem:
|
|||
" WHERE shopfloor_id = %s AND sensor_id = %s ", (id_, sid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_SENSOR_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1389,7 +1389,7 @@ class ShopfloorSensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1482,7 +1482,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1491,7 +1491,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1501,7 +1501,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1511,7 +1511,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/shopfloors/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -1547,7 +1547,7 @@ class ShopfloorVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1556,7 +1556,7 @@ class ShopfloorVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1565,7 +1565,7 @@ class ShopfloorVirtualMeterItem:
|
|||
" WHERE shopfloor_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1574,7 +1574,7 @@ class ShopfloorVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class SpaceCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -189,7 +189,7 @@ class SpaceCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.SPACE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ class SpaceCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PARENT_SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ class SpaceCollection:
|
|||
(new_values['data']['timezone_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TIMEZONE_NOT_FOUND')
|
||||
if contact_id is not None:
|
||||
|
|
@ -222,7 +222,7 @@ class SpaceCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ class SpaceCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ class SpaceCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(new_id)
|
||||
|
|
@ -336,7 +336,7 @@ class SpaceItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -380,7 +380,7 @@ class SpaceItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ class SpaceItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_CHILDREN_SPACES')
|
||||
|
|
@ -405,7 +405,7 @@ class SpaceItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -418,7 +418,7 @@ class SpaceItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -431,7 +431,7 @@ class SpaceItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -444,7 +444,7 @@ class SpaceItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -456,7 +456,7 @@ class SpaceItem:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -469,7 +469,7 @@ class SpaceItem:
|
|||
rows_sensors = cursor.fetchall()
|
||||
if rows_sensors is not None and len(rows_sensors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
|
@ -481,7 +481,7 @@ class SpaceItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -493,7 +493,7 @@ class SpaceItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -506,7 +506,7 @@ class SpaceItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METERS')
|
||||
|
|
@ -515,7 +515,7 @@ class SpaceItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ class SpaceItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -620,7 +620,7 @@ class SpaceItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.SPACE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -632,7 +632,7 @@ class SpaceItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PARENT_SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ class SpaceItem:
|
|||
(new_values['data']['timezone_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TIMEZONE_NOT_FOUND')
|
||||
if contact_id is not None:
|
||||
|
|
@ -653,7 +653,7 @@ class SpaceItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ class SpaceItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -687,7 +687,7 @@ class SpaceItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ class SpaceChildrenCollection:
|
|||
row_current_space = cursor.fetchone()
|
||||
if row_current_space is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
# note: row_current_space will be used at the end
|
||||
|
|
@ -819,7 +819,7 @@ class SpaceChildrenCollection:
|
|||
result['children'].append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -897,7 +897,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -906,7 +906,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
" WHERE id = %s ", (combined_equipment_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
cursor.execute(query, (id_, combined_equipment_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_COMBINED_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -926,7 +926,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/combinedequipments/' + str(combined_equipment_id)
|
||||
|
|
@ -962,7 +962,7 @@ class SpaceCombinedEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -971,7 +971,7 @@ class SpaceCombinedEquipmentItem:
|
|||
" WHERE id = %s ", (eid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -980,7 +980,7 @@ class SpaceCombinedEquipmentItem:
|
|||
" WHERE space_id = %s AND combined_equipment_id = %s ", (id_, eid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_COMBINED_EQUIPMENT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -989,7 +989,7 @@ class SpaceCombinedEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1018,7 +1018,7 @@ class SpaceEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1068,7 +1068,7 @@ class SpaceEquipmentCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1077,7 +1077,7 @@ class SpaceEquipmentCollection:
|
|||
" WHERE id = %s ", (equipment_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1087,7 +1087,7 @@ class SpaceEquipmentCollection:
|
|||
cursor.execute(query, (id_, equipment_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1097,7 +1097,7 @@ class SpaceEquipmentCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/equipments/' + str(equipment_id)
|
||||
|
|
@ -1133,7 +1133,7 @@ class SpaceEquipmentItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1142,7 +1142,7 @@ class SpaceEquipmentItem:
|
|||
" WHERE id = %s ", (eid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1151,7 +1151,7 @@ class SpaceEquipmentItem:
|
|||
" WHERE space_id = %s AND equipment_id = %s ", (id_, eid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_EQUIPMENT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1159,7 +1159,7 @@ class SpaceEquipmentItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1188,7 +1188,7 @@ class SpaceMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1252,7 +1252,7 @@ class SpaceMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1261,7 +1261,7 @@ class SpaceMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1271,7 +1271,7 @@ class SpaceMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1281,7 +1281,7 @@ class SpaceMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -1317,7 +1317,7 @@ class SpaceMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1326,7 +1326,7 @@ class SpaceMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1337,7 +1337,7 @@ class SpaceMeterItem:
|
|||
rows = cursor.fetchall()
|
||||
if rows is None or len(rows) == 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1345,7 +1345,7 @@ class SpaceMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1374,7 +1374,7 @@ class SpaceOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1438,7 +1438,7 @@ class SpaceOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1447,7 +1447,7 @@ class SpaceOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1457,7 +1457,7 @@ class SpaceOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1467,7 +1467,7 @@ class SpaceOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -1503,7 +1503,7 @@ class SpaceOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1512,7 +1512,7 @@ class SpaceOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1521,7 +1521,7 @@ class SpaceOfflineMeterItem:
|
|||
" WHERE space_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1530,7 +1530,7 @@ class SpaceOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1559,7 +1559,7 @@ class SpacePointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1622,7 +1622,7 @@ class SpacePointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1631,7 +1631,7 @@ class SpacePointCollection:
|
|||
" WHERE id = %s ", (point_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1641,7 +1641,7 @@ class SpacePointCollection:
|
|||
cursor.execute(query, (id_, point_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1651,7 +1651,7 @@ class SpacePointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/points/' + str(point_id)
|
||||
|
|
@ -1687,7 +1687,7 @@ class SpacePointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1696,7 +1696,7 @@ class SpacePointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1705,7 +1705,7 @@ class SpacePointItem:
|
|||
" WHERE space_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1714,7 +1714,7 @@ class SpacePointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1743,7 +1743,7 @@ class SpaceSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1793,7 +1793,7 @@ class SpaceSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1802,7 +1802,7 @@ class SpaceSensorCollection:
|
|||
" WHERE id = %s ", (sensor_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1812,7 +1812,7 @@ class SpaceSensorCollection:
|
|||
cursor.execute(query, (id_, sensor_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_SENSOR_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1822,7 +1822,7 @@ class SpaceSensorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/sensors/' + str(sensor_id)
|
||||
|
|
@ -1858,7 +1858,7 @@ class SpaceSensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1867,7 +1867,7 @@ class SpaceSensorItem:
|
|||
" WHERE id = %s ", (sid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1876,7 +1876,7 @@ class SpaceSensorItem:
|
|||
" WHERE space_id = %s AND sensor_id = %s ", (id_, sid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_SENSOR_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1884,7 +1884,7 @@ class SpaceSensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1913,7 +1913,7 @@ class SpaceShopfloorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1963,7 +1963,7 @@ class SpaceShopfloorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1972,7 +1972,7 @@ class SpaceShopfloorCollection:
|
|||
" WHERE id = %s ", (shopfloor_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1982,7 +1982,7 @@ class SpaceShopfloorCollection:
|
|||
cursor.execute(query, (id_, shopfloor_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_SHOPFLOOR_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1992,7 +1992,7 @@ class SpaceShopfloorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/shopfloors/' + str(shopfloor_id)
|
||||
|
|
@ -2028,7 +2028,7 @@ class SpaceShopfloorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2037,7 +2037,7 @@ class SpaceShopfloorItem:
|
|||
" WHERE id = %s ", (sid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -2046,7 +2046,7 @@ class SpaceShopfloorItem:
|
|||
" WHERE space_id = %s AND shopfloor_id = %s ", (id_, sid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_SHOPFLOOR_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -2054,7 +2054,7 @@ class SpaceShopfloorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -2083,7 +2083,7 @@ class SpaceStoreCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2133,7 +2133,7 @@ class SpaceStoreCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2142,7 +2142,7 @@ class SpaceStoreCollection:
|
|||
" WHERE id = %s ", (store_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2152,7 +2152,7 @@ class SpaceStoreCollection:
|
|||
cursor.execute(query, (id_, store_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_STORE_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -2162,7 +2162,7 @@ class SpaceStoreCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/stores/' + str(store_id)
|
||||
|
|
@ -2198,7 +2198,7 @@ class SpaceStoreItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2207,7 +2207,7 @@ class SpaceStoreItem:
|
|||
" WHERE id = %s ", (tid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2216,7 +2216,7 @@ class SpaceStoreItem:
|
|||
" WHERE space_id = %s AND store_id = %s ", (id_, tid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_STORE_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -2224,7 +2224,7 @@ class SpaceStoreItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -2253,7 +2253,7 @@ class SpaceTenantCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2303,7 +2303,7 @@ class SpaceTenantCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2312,7 +2312,7 @@ class SpaceTenantCollection:
|
|||
" WHERE id = %s ", (tenant_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -2322,7 +2322,7 @@ class SpaceTenantCollection:
|
|||
cursor.execute(query, (id_, tenant_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_TENANT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -2332,7 +2332,7 @@ class SpaceTenantCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/tenants/' + str(tenant_id)
|
||||
|
|
@ -2368,7 +2368,7 @@ class SpaceTenantItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2377,7 +2377,7 @@ class SpaceTenantItem:
|
|||
" WHERE id = %s ", (tid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -2386,7 +2386,7 @@ class SpaceTenantItem:
|
|||
" WHERE space_id = %s AND tenant_id = %s ", (id_, tid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_TENANT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -2394,7 +2394,7 @@ class SpaceTenantItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -2423,7 +2423,7 @@ class SpaceVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2487,7 +2487,7 @@ class SpaceVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2496,7 +2496,7 @@ class SpaceVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -2506,7 +2506,7 @@ class SpaceVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -2516,7 +2516,7 @@ class SpaceVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/spaces/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -2552,7 +2552,7 @@ class SpaceVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -2561,7 +2561,7 @@ class SpaceVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -2570,7 +2570,7 @@ class SpaceVirtualMeterItem:
|
|||
" WHERE space_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -2579,7 +2579,7 @@ class SpaceVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -2621,14 +2621,14 @@ class SpaceTreeCollection:
|
|||
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.USER_SESSION_NOT_FOUND')
|
||||
else:
|
||||
utc_expires = row[0]
|
||||
if datetime.utcnow() > utc_expires:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
# get privilege
|
||||
|
|
@ -2639,7 +2639,7 @@ class SpaceTreeCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND', 'API.USER_NOT_FOUND')
|
||||
else:
|
||||
is_admin = bool(row[0])
|
||||
|
|
@ -2658,7 +2658,7 @@ class SpaceTreeCollection:
|
|||
cursor.execute(query, (privilege_id,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -2692,5 +2692,5 @@ class SpaceTreeCollection:
|
|||
node_dict[row['id']] = AnyNode(id=row['id'], parent=parent_node, name=row['name'])
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = JsonExporter(sort_keys=True).export(node_dict[space_id], )
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class StoreCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -185,7 +185,7 @@ class StoreCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.STORE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ class StoreCollection:
|
|||
(store_type_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ class StoreCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ class StoreCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ class StoreCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(new_id)
|
||||
|
|
@ -310,7 +310,7 @@ class StoreItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -351,7 +351,7 @@ class StoreItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ class StoreItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -376,7 +376,7 @@ class StoreItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -389,7 +389,7 @@ class StoreItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -401,7 +401,7 @@ class StoreItem:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -414,7 +414,7 @@ class StoreItem:
|
|||
rows_sensors = cursor.fetchall()
|
||||
if rows_sensors is not None and len(rows_sensors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
|
@ -427,7 +427,7 @@ class StoreItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METERS')
|
||||
|
|
@ -436,7 +436,7 @@ class StoreItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -538,7 +538,7 @@ class StoreItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -547,7 +547,7 @@ class StoreItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.STORE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ class StoreItem:
|
|||
(store_type_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ class StoreItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ class StoreItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -603,7 +603,7 @@ class StoreItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -632,7 +632,7 @@ class StoreMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -696,7 +696,7 @@ class StoreMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -705,7 +705,7 @@ class StoreMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -715,7 +715,7 @@ class StoreMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -725,7 +725,7 @@ class StoreMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -761,7 +761,7 @@ class StoreMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -770,7 +770,7 @@ class StoreMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -779,7 +779,7 @@ class StoreMeterItem:
|
|||
" WHERE store_id = %s AND meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -787,7 +787,7 @@ class StoreMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ class StoreOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -880,7 +880,7 @@ class StoreOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -889,7 +889,7 @@ class StoreOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -899,7 +899,7 @@ class StoreOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -909,7 +909,7 @@ class StoreOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -945,7 +945,7 @@ class StoreOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -954,7 +954,7 @@ class StoreOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -963,7 +963,7 @@ class StoreOfflineMeterItem:
|
|||
" WHERE store_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -972,7 +972,7 @@ class StoreOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1001,7 +1001,7 @@ class StorePointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1064,7 +1064,7 @@ class StorePointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ class StorePointCollection:
|
|||
" WHERE id = %s ", (point_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ class StorePointCollection:
|
|||
cursor.execute(query, (id_, point_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1093,7 +1093,7 @@ class StorePointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(id_) + '/points/' + str(point_id)
|
||||
|
|
@ -1129,7 +1129,7 @@ class StorePointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1138,7 +1138,7 @@ class StorePointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1147,7 +1147,7 @@ class StorePointItem:
|
|||
" WHERE store_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1156,7 +1156,7 @@ class StorePointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1185,7 +1185,7 @@ class StoreSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1235,7 +1235,7 @@ class StoreSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1244,7 +1244,7 @@ class StoreSensorCollection:
|
|||
" WHERE id = %s ", (sensor_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1254,7 +1254,7 @@ class StoreSensorCollection:
|
|||
cursor.execute(query, (id_, sensor_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_SENSOR_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1264,7 +1264,7 @@ class StoreSensorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(id_) + '/sensors/' + str(sensor_id)
|
||||
|
|
@ -1300,7 +1300,7 @@ class StoreSensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1309,7 +1309,7 @@ class StoreSensorItem:
|
|||
" WHERE id = %s ", (sid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1318,7 +1318,7 @@ class StoreSensorItem:
|
|||
" WHERE store_id = %s AND sensor_id = %s ", (id_, sid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_SENSOR_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1326,7 +1326,7 @@ class StoreSensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1355,7 +1355,7 @@ class StoreVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1419,7 +1419,7 @@ class StoreVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1428,7 +1428,7 @@ class StoreVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1438,7 +1438,7 @@ class StoreVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1448,7 +1448,7 @@ class StoreVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/stores/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -1484,7 +1484,7 @@ class StoreVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_NOT_FOUND')
|
||||
|
||||
|
|
@ -1493,7 +1493,7 @@ class StoreVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1502,7 +1502,7 @@ class StoreVirtualMeterItem:
|
|||
" WHERE store_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1511,7 +1511,7 @@ class StoreVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class StoreTypeCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -82,7 +82,7 @@ class StoreTypeCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.STORE_TYPE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class StoreTypeCollection:
|
|||
" WHERE simplified_code = %s ", (simplified_code,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.STORE_TYPE_SIMPLIFIED_CODE_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class StoreTypeCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/storetypes/' + str(new_id)
|
||||
|
|
@ -136,7 +136,7 @@ class StoreTypeItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_TYPE_NOT_FOUND')
|
||||
|
|
@ -165,7 +165,7 @@ class StoreTypeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class StoreTypeItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.STORE_TYPE_USED_IN_STORE')
|
||||
|
|
@ -184,7 +184,7 @@ class StoreTypeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -234,7 +234,7 @@ class StoreTypeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.STORE_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class StoreTypeItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.STORE_TYPE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ class StoreTypeItem:
|
|||
" WHERE simplified_code = %s AND id != %s ", (simplified_code, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.STORE_TYPE_SIMPLIFIED_CODE_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -265,6 +265,6 @@ class StoreTypeItem:
|
|||
id_,))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class TariffCollection:
|
|||
meta_result['timeofuse'].append(meta_data)
|
||||
else:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.ERROR',
|
||||
description='API.INVALID_TARIFF_TYPE')
|
||||
|
|
@ -93,7 +93,7 @@ class TariffCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class TariffCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ class TariffCollection:
|
|||
" WHERE id = %s ", (energy_category_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class TariffCollection:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tariffs/' + str(new_id)
|
||||
|
|
@ -252,7 +252,7 @@ class TariffItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_NOT_FOUND')
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ class TariffItem:
|
|||
result['timeofuse'].append(meta_data)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ class TariffItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_NOT_FOUND')
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ class TariffItem:
|
|||
rows = cursor.fetchall()
|
||||
if rows is not None and len(rows) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_NOT_EMPTY')
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ class TariffItem:
|
|||
rows = cursor.fetchall()
|
||||
if rows is not None and len(rows) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_NOT_EMPTY')
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ class TariffItem:
|
|||
rows = cursor.fetchall()
|
||||
if rows is not None and len(rows) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_IN_USE')
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ class TariffItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ class TariffItem:
|
|||
|
||||
if cursor.rowcount != 1:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TARIFF_NOT_FOUND')
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ class TariffItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ class TariffItem:
|
|||
if tariff_type == 'block':
|
||||
if 'block' not in new_values['data'].keys() or new_values['data']['block'] is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.INVALID_TARIFF_BLOCK_PRICING')
|
||||
|
|
@ -503,7 +503,7 @@ class TariffItem:
|
|||
elif tariff_type == 'timeofuse':
|
||||
if 'timeofuse' not in new_values['data'].keys() or new_values['data']['timeofuse'] is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.INVALID_TARIFF_TIME_OF_USE_PRICING')
|
||||
|
|
@ -530,7 +530,7 @@ class TariffItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class TenantCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -232,7 +232,7 @@ class TenantCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ class TenantCollection:
|
|||
(tenant_type_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ class TenantCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ class TenantCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ class TenantCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(new_id)
|
||||
|
|
@ -364,7 +364,7 @@ class TenantItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -418,7 +418,7 @@ class TenantItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -430,7 +430,7 @@ class TenantItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -443,7 +443,7 @@ class TenantItem:
|
|||
rows_meters = cursor.fetchall()
|
||||
if rows_meters is not None and len(rows_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_METERS')
|
||||
|
|
@ -456,7 +456,7 @@ class TenantItem:
|
|||
rows_offline_meters = cursor.fetchall()
|
||||
if rows_offline_meters is not None and len(rows_offline_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OFFLINE_METERS')
|
||||
|
|
@ -468,7 +468,7 @@ class TenantItem:
|
|||
rows_points = cursor.fetchall()
|
||||
if rows_points is not None and len(rows_points) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_POINTS')
|
||||
|
|
@ -481,7 +481,7 @@ class TenantItem:
|
|||
rows_sensors = cursor.fetchall()
|
||||
if rows_sensors is not None and len(rows_sensors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
|
@ -494,7 +494,7 @@ class TenantItem:
|
|||
rows_virtual_meters = cursor.fetchall()
|
||||
if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_VIRTUAL_METER')
|
||||
|
|
@ -503,7 +503,7 @@ class TenantItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -635,7 +635,7 @@ class TenantItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -644,7 +644,7 @@ class TenantItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -654,7 +654,7 @@ class TenantItem:
|
|||
(tenant_type_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ class TenantItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.CONTACT_NOT_FOUND')
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ class TenantItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ class TenantItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -735,7 +735,7 @@ class TenantMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -799,7 +799,7 @@ class TenantMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -808,7 +808,7 @@ class TenantMeterCollection:
|
|||
" WHERE id = %s ", (meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -818,7 +818,7 @@ class TenantMeterCollection:
|
|||
cursor.execute(query, (id_, meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -828,7 +828,7 @@ class TenantMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(id_) + '/meters/' + str(meter_id)
|
||||
|
|
@ -864,7 +864,7 @@ class TenantMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -873,7 +873,7 @@ class TenantMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -882,7 +882,7 @@ class TenantMeterItem:
|
|||
" WHERE tenant_id = %s AND meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -890,7 +890,7 @@ class TenantMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -919,7 +919,7 @@ class TenantOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -983,7 +983,7 @@ class TenantOfflineMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -992,7 +992,7 @@ class TenantOfflineMeterCollection:
|
|||
" WHERE id = %s ", (offline_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1002,7 +1002,7 @@ class TenantOfflineMeterCollection:
|
|||
cursor.execute(query, (id_, offline_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1012,7 +1012,7 @@ class TenantOfflineMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(id_) + '/offlinemeters/' + str(offline_meter_id)
|
||||
|
|
@ -1048,7 +1048,7 @@ class TenantOfflineMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1057,7 +1057,7 @@ class TenantOfflineMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1066,7 +1066,7 @@ class TenantOfflineMeterItem:
|
|||
" WHERE tenant_id = %s AND offline_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_OFFLINE_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1075,7 +1075,7 @@ class TenantOfflineMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1104,7 +1104,7 @@ class TenantPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1167,7 +1167,7 @@ class TenantPointCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1176,7 +1176,7 @@ class TenantPointCollection:
|
|||
" WHERE id = %s ", (point_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1186,7 +1186,7 @@ class TenantPointCollection:
|
|||
cursor.execute(query, (id_, point_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_POINT_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ class TenantPointCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(id_) + '/points/' + str(point_id)
|
||||
|
|
@ -1232,7 +1232,7 @@ class TenantPointItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1241,7 +1241,7 @@ class TenantPointItem:
|
|||
" WHERE id = %s ", (pid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.POINT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1250,7 +1250,7 @@ class TenantPointItem:
|
|||
" WHERE tenant_id = %s AND point_id = %s ", (id_, pid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_POINT_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1259,7 +1259,7 @@ class TenantPointItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1288,7 +1288,7 @@ class TenantSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1338,7 +1338,7 @@ class TenantSensorCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1347,7 +1347,7 @@ class TenantSensorCollection:
|
|||
" WHERE id = %s ", (sensor_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1357,7 +1357,7 @@ class TenantSensorCollection:
|
|||
cursor.execute(query, (id_, sensor_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_SENSOR_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1367,7 +1367,7 @@ class TenantSensorCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(id_) + '/sensors/' + str(sensor_id)
|
||||
|
|
@ -1403,7 +1403,7 @@ class TenantSensorItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1412,7 +1412,7 @@ class TenantSensorItem:
|
|||
" WHERE id = %s ", (sid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SENSOR_NOT_FOUND')
|
||||
|
||||
|
|
@ -1421,7 +1421,7 @@ class TenantSensorItem:
|
|||
" WHERE tenant_id = %s AND sensor_id = %s ", (id_, sid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_SENSOR_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1429,7 +1429,7 @@ class TenantSensorItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -1458,7 +1458,7 @@ class TenantVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1522,7 +1522,7 @@ class TenantVirtualMeterCollection:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1531,7 +1531,7 @@ class TenantVirtualMeterCollection:
|
|||
" WHERE id = %s ", (virtual_meter_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1541,7 +1541,7 @@ class TenantVirtualMeterCollection:
|
|||
cursor.execute(query, (id_, virtual_meter_id,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
|
|
@ -1551,7 +1551,7 @@ class TenantVirtualMeterCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenants/' + str(id_) + '/virtualmeters/' + str(virtual_meter_id)
|
||||
|
|
@ -1587,7 +1587,7 @@ class TenantVirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_NOT_FOUND')
|
||||
|
||||
|
|
@ -1596,7 +1596,7 @@ class TenantVirtualMeterItem:
|
|||
" WHERE id = %s ", (mid,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -1605,7 +1605,7 @@ class TenantVirtualMeterItem:
|
|||
" WHERE tenant_id = %s AND virtual_meter_id = %s ", (id_, mid))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_VIRTUAL_METER_RELATION_NOT_FOUND')
|
||||
|
||||
|
|
@ -1614,7 +1614,7 @@ class TenantVirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class TenantTypeCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -82,7 +82,7 @@ class TenantTypeCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_TYPE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class TenantTypeCollection:
|
|||
" WHERE simplified_code = %s ", (simplified_code,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_TYPE_SIMPLIFIED_CODE_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class TenantTypeCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/tenanttypes/' + str(new_id)
|
||||
|
|
@ -136,7 +136,7 @@ class TenantTypeItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_TYPE_NOT_FOUND')
|
||||
|
|
@ -165,7 +165,7 @@ class TenantTypeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class TenantTypeItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.TENANT_TYPE_USED_IN_TENANT')
|
||||
|
|
@ -184,7 +184,7 @@ class TenantTypeItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -234,7 +234,7 @@ class TenantTypeItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TENANT_TYPE_NOT_FOUND')
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class TenantTypeItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_TYPE_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ class TenantTypeItem:
|
|||
" WHERE simplified_code = %s AND id != %s ", (simplified_code, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.TENANT_TYPE_SIMPLIFIED_CODE_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -265,6 +265,6 @@ class TenantTypeItem:
|
|||
id_,))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class TextMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -194,7 +194,7 @@ class TextMessageCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class TextMessageCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/textmessages/' + str(new_id)
|
||||
|
|
@ -251,7 +251,7 @@ class TextMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -382,7 +382,7 @@ class TextMessageItem:
|
|||
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TEXT_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ class TextMessageItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -416,7 +416,7 @@ class TextMessageItem:
|
|||
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ class TextMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TEXT_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -448,6 +448,6 @@ class TextMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class TimezoneCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -62,14 +62,14 @@ class TimezoneItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TIMEZONE_NOT_FOUND')
|
||||
|
||||
result = {"id": row[0], "name": row[1], "description": row[2], "utc_offset": row[3]}
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ class TimezoneItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.TIMEZONE_NOT_FOUND')
|
||||
|
||||
|
|
@ -111,6 +111,6 @@ class TimezoneItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class UserCollection:
|
|||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
|
||||
if config.utc_offset[0] == '-':
|
||||
|
|
@ -140,7 +140,7 @@ class UserCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.USER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ class UserCollection:
|
|||
" WHERE email = %s ", (email,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.EMAIL_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ class UserCollection:
|
|||
(privilege_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PRIVILEGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ class UserCollection:
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/users/' + str(new_id)
|
||||
|
|
@ -222,7 +222,7 @@ class UserItem:
|
|||
cursor.execute(query, (id_,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -266,7 +266,7 @@ class UserItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.USER_NOT_FOUND')
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ class UserItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ class UserItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.USER_NOT_FOUND')
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ class UserItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.USER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ class UserItem:
|
|||
" WHERE email = %s AND id != %s ", (email, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.EMAIL_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ class UserItem:
|
|||
(privilege_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.PRIVILEGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ class UserItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ class UserLogin:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.ERROR', 'API.USER_NOT_FOUND')
|
||||
|
||||
result = {"id": row[0],
|
||||
|
|
@ -485,7 +485,7 @@ class UserLogin:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.ERROR', 'API.USER_NOT_FOUND')
|
||||
|
||||
result = {"id": row[0],
|
||||
|
|
@ -502,7 +502,7 @@ class UserLogin:
|
|||
|
||||
else:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_NAME_OR_EMAIL')
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ class UserLogin:
|
|||
|
||||
if failed_login_count >= config.maximum_failed_login_count:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.USER_ACCOUNT_HAS_BEEN_LOCKED')
|
||||
|
||||
salt = result['salt']
|
||||
|
|
@ -525,7 +525,7 @@ class UserLogin:
|
|||
cursor.execute(update_failed_login_count, (failed_login_count + 1, user_uuid))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_PASSWORD')
|
||||
|
||||
if failed_login_count != 0:
|
||||
|
|
@ -538,12 +538,12 @@ class UserLogin:
|
|||
|
||||
if result['account_expiration_datetime_utc'] <= datetime.utcnow():
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.USER_ACCOUNT_HAS_EXPIRED')
|
||||
|
||||
if result['password_expiration_datetime_utc'] <= datetime.utcnow():
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.USER_PASSWORD_HAS_EXPIRED')
|
||||
|
||||
add_session = (" INSERT INTO tbl_sessions "
|
||||
|
|
@ -555,7 +555,7 @@ class UserLogin:
|
|||
cursor.execute(add_session, (user_uuid, token, utc_expires))
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
del result['salt']
|
||||
del result['password']
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ class UserLogout:
|
|||
rowcount = cursor.rowcount
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if rowcount is None or rowcount == 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.USER_SESSION_NOT_FOUND')
|
||||
|
|
@ -685,14 +685,14 @@ class ChangePassword:
|
|||
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.USER_SESSION_NOT_FOUND')
|
||||
else:
|
||||
utc_expires = row[0]
|
||||
if datetime.utcnow() > utc_expires:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -703,7 +703,7 @@ class ChangePassword:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND', 'API.USER_NOT_FOUND')
|
||||
|
||||
result = {'salt': row[0], 'password': row[1]}
|
||||
|
|
@ -714,7 +714,7 @@ class ChangePassword:
|
|||
|
||||
if hashed_password != result['password']:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_OLD_PASSWORD')
|
||||
|
||||
# Update User password
|
||||
|
|
@ -736,7 +736,7 @@ class ChangePassword:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps("OK")
|
||||
resp.status = falcon.HTTP_200
|
||||
write_log(user_uuid=user_uuid, request_method='PUT', resource_type='ChangePassword',
|
||||
|
|
@ -801,14 +801,14 @@ class ResetPassword:
|
|||
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ADMINISTRATOR_SESSION_NOT_FOUND')
|
||||
else:
|
||||
utc_expires = row[0]
|
||||
if datetime.utcnow() > utc_expires:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.ADMINISTRATOR_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -819,7 +819,7 @@ class ResetPassword:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_PRIVILEGE')
|
||||
|
||||
salt = uuid.uuid4().hex
|
||||
|
|
@ -838,7 +838,7 @@ class ResetPassword:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_USERNAME')
|
||||
|
||||
user_id = row[0]
|
||||
|
|
@ -852,7 +852,7 @@ class ResetPassword:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps("OK")
|
||||
resp.status = falcon.HTTP_200
|
||||
write_log(user_uuid=admin_user_uuid, request_method='PUT', resource_type='ResetPassword',
|
||||
|
|
@ -895,13 +895,13 @@ class Unlock:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_Id')
|
||||
|
||||
failed_login_count = row[0]
|
||||
if failed_login_count < config.maximum_failed_login_count:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.USER_ACCOUNT_IS_NOT_LOCKED')
|
||||
|
||||
update_user = (" UPDATE tbl_users "
|
||||
|
|
@ -917,11 +917,11 @@ class Unlock:
|
|||
row = cursor.fetchone()
|
||||
if row is None or row[0] != 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.ACCOUNT_UNLOCK_FAILED')
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps("OK")
|
||||
resp.status = falcon.HTTP_200
|
||||
write_log(user_uuid=admin_user_uuid, request_method='PUT', resource_type='UnlockUser',
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ def access_control(req):
|
|||
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ADMINISTRATOR_SESSION_NOT_FOUND')
|
||||
else:
|
||||
utc_expires = row[0]
|
||||
if datetime.utcnow() > utc_expires:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.ADMINISTRATOR_SESSION_TIMEOUT')
|
||||
query = (" SELECT name "
|
||||
|
|
@ -56,7 +56,7 @@ def access_control(req):
|
|||
cursor.execute(query, (admin_user_uuid,))
|
||||
row = cursor.fetchone()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, 'API.BAD_REQUEST', 'API.INVALID_PRIVILEGE')
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ def write_log(user_uuid, request_method, resource_type, resource_id, request_bod
|
|||
print('write_log:' + str(e))
|
||||
finally:
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -235,7 +235,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
for row in rows_tariffs:
|
||||
|
|
@ -253,7 +253,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -261,7 +261,7 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_timeofuse_tariffs is None or len(rows_timeofuse_tariffs) == 0:
|
||||
return dict()
|
||||
|
|
@ -330,7 +330,7 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -339,7 +339,7 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
for row in rows_tariffs:
|
||||
|
|
@ -357,7 +357,7 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat
|
|||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
return dict()
|
||||
|
|
@ -365,7 +365,7 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if rows_timeofuse_tariffs is None or len(rows_timeofuse_tariffs) == 0:
|
||||
return dict()
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class VirtualMeterCollection:
|
|||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -230,7 +230,7 @@ class VirtualMeterCollection:
|
|||
" WHERE name = %s ", (name,))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ class VirtualMeterCollection:
|
|||
(energy_category_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ class VirtualMeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -263,13 +263,13 @@ class VirtualMeterCollection:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_IS_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ class VirtualMeterCollection:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -290,7 +290,7 @@ class VirtualMeterCollection:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -300,7 +300,7 @@ class VirtualMeterCollection:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -331,7 +331,7 @@ class VirtualMeterCollection:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/virtualmeters/' + str(new_id)
|
||||
|
|
@ -469,7 +469,7 @@ class VirtualMeterItem:
|
|||
meta_result['expression'] = expression
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
resp.text = json.dumps(meta_result)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -489,7 +489,7 @@ class VirtualMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -503,7 +503,7 @@ class VirtualMeterItem:
|
|||
row_virtual_meter = cursor.fetchone()
|
||||
if row_virtual_meter is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_OTHER_VIRTUAL_METERS')
|
||||
|
|
@ -515,7 +515,7 @@ class VirtualMeterItem:
|
|||
rows_spaces = cursor.fetchall()
|
||||
if rows_spaces is not None and len(rows_spaces) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
|
@ -528,7 +528,7 @@ class VirtualMeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENTS')
|
||||
|
|
@ -541,7 +541,7 @@ class VirtualMeterItem:
|
|||
rows_combined_equipments = cursor.fetchall()
|
||||
if rows_combined_equipments is not None and len(rows_combined_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_COMBINED_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -553,7 +553,7 @@ class VirtualMeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
|
@ -566,7 +566,7 @@ class VirtualMeterItem:
|
|||
rows_equipments = cursor.fetchall()
|
||||
if rows_equipments is not None and len(rows_equipments) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENT_PARAMETERS')
|
||||
|
|
@ -578,7 +578,7 @@ class VirtualMeterItem:
|
|||
rows_tenants = cursor.fetchall()
|
||||
if rows_tenants is not None and len(rows_tenants) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_TENANTS')
|
||||
|
|
@ -590,7 +590,7 @@ class VirtualMeterItem:
|
|||
rows_stores = cursor.fetchall()
|
||||
if rows_stores is not None and len(rows_stores) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_STORES')
|
||||
|
|
@ -602,7 +602,7 @@ class VirtualMeterItem:
|
|||
rows_shopfloors = cursor.fetchall()
|
||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SHOPFLOORS')
|
||||
|
|
@ -614,7 +614,7 @@ class VirtualMeterItem:
|
|||
rows_links = cursor.fetchall()
|
||||
if rows_links is not None and len(rows_links) > 0:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_ENERGY_FLOW_DIAGRAM_LINKS')
|
||||
|
|
@ -632,7 +632,7 @@ class VirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
|
@ -732,7 +732,7 @@ class VirtualMeterItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -741,7 +741,7 @@ class VirtualMeterItem:
|
|||
" WHERE name = %s AND id != %s ", (name, id_))
|
||||
if cursor.fetchone() is not None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.VIRTUAL_METER_NAME_IS_ALREADY_IN_USE')
|
||||
|
||||
|
|
@ -751,7 +751,7 @@ class VirtualMeterItem:
|
|||
(energy_category_id,))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
||||
|
|
@ -762,7 +762,7 @@ class VirtualMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COST_CENTER_NOT_FOUND')
|
||||
|
||||
|
|
@ -774,13 +774,13 @@ class VirtualMeterItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
else:
|
||||
if row[1] != energy_category_id:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.ENERGY_ITEM_IS_NOT_BELONG_TO_ENERGY_CATEGORY')
|
||||
|
||||
|
|
@ -791,7 +791,7 @@ class VirtualMeterItem:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -801,7 +801,7 @@ class VirtualMeterItem:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.OFFLINE_METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -811,7 +811,7 @@ class VirtualMeterItem:
|
|||
" WHERE id = %s ", (variable['meter_id'],))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.VIRTUAL_METER_OF_VARIABLE_NOT_FOUND')
|
||||
|
|
@ -850,7 +850,7 @@ class VirtualMeterItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class WebMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -89,7 +89,7 @@ class WebMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ class WebMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -111,7 +111,7 @@ class WebMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
# get web messages
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
|
|
@ -129,7 +129,7 @@ class WebMessageCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -181,7 +181,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -190,7 +190,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -212,7 +212,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
# get 'new' web messages
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
|
|
@ -230,7 +230,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -298,7 +298,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -307,7 +307,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -329,7 +329,7 @@ class WebMessageStatusNewCollection:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
|
@ -339,7 +339,7 @@ class WebMessageStatusNewCollection:
|
|||
" WHERE status = %s AND user_id = %s ", ('new', user_id))
|
||||
if cursor.fetchall() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.WEB_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ class WebMessageStatusNewCollection:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -407,7 +407,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -429,7 +429,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
# get web message by id
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
|
|
@ -446,7 +446,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -518,7 +518,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -527,7 +527,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -549,7 +549,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
|
@ -559,7 +559,7 @@ class WebMessageItem:
|
|||
" WHERE id = %s AND user_id = %s ", (id_, user_id))
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.WEB_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -572,7 +572,7 @@ class WebMessageItem:
|
|||
cnx.commit()
|
||||
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -606,7 +606,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_SESSION_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -615,7 +615,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.USER_SESSION_TIMEOUT')
|
||||
|
||||
|
|
@ -628,7 +628,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_USER_PLEASE_RE_LOGIN')
|
||||
else:
|
||||
|
|
@ -637,7 +637,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
|
@ -651,7 +651,7 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.WEB_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -660,6 +660,6 @@ class WebMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class WechatMessageCollection(object):
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
result = list()
|
||||
if rows is not None and len(rows) > 0:
|
||||
|
|
@ -218,7 +218,7 @@ class WechatMessageCollection(object):
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ class WechatMessageCollection(object):
|
|||
new_id = cursor.lastrowid
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_201
|
||||
resp.location = '/wechatmessages/' + str(new_id)
|
||||
|
|
@ -276,7 +276,7 @@ class WechatMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
|
|
@ -429,7 +429,7 @@ class WechatMessageItem:
|
|||
|
||||
if cursor.fetchone() is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.WECHAT_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ class WechatMessageItem:
|
|||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ class WechatMessageItem:
|
|||
|
||||
cnx.commit()
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
|
@ -488,7 +488,7 @@ class WechatMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.WECHAT_MESSAGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -498,6 +498,6 @@ class WechatMessageItem:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class AdvancedReportCollection:
|
|||
if cursor_reporting:
|
||||
cursor_reporting.close()
|
||||
if cnx_reporting:
|
||||
cnx_reporting.disconnect()
|
||||
cnx_reporting.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 3: construct the result
|
||||
|
|
@ -136,7 +136,7 @@ class AdvancedReportItem:
|
|||
if cursor_reporting:
|
||||
cursor_reporting.close()
|
||||
if cnx_reporting:
|
||||
cnx_reporting.disconnect()
|
||||
cnx_reporting.close()
|
||||
|
||||
if row is None:
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
|
|
@ -172,7 +172,7 @@ class AdvancedReportItem:
|
|||
" WHERE id = %s ", (id_,))
|
||||
if cursor_reporting.fetchone() is None:
|
||||
cursor_reporting.close()
|
||||
cnx_reporting.disconnect()
|
||||
cnx_reporting.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ADVANCED_REPORT_NOT_FOUND')
|
||||
|
|
@ -184,6 +184,6 @@ class AdvancedReportItem:
|
|||
if cursor_reporting:
|
||||
cursor_reporting.close()
|
||||
if cnx_reporting:
|
||||
cnx_reporting.disconnect()
|
||||
cnx_reporting.close()
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -166,12 +166,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -209,12 +209,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -514,17 +514,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -170,17 +170,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
||||
|
|
@ -226,17 +226,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -789,12 +789,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -529,17 +529,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -221,17 +221,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -518,17 +518,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -494,17 +494,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -527,17 +527,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -495,17 +495,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -165,22 +165,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -227,22 +227,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -688,22 +688,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.COMBINED_EQUIPMENT_NOT_FOUND')
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -520,17 +520,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class Reporting:
|
|||
if cursor_user:
|
||||
cursor_user.close()
|
||||
if cnx_user:
|
||||
cnx_user.disconnect()
|
||||
cnx_user.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND', 'API.USER_NOT_FOUND')
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ class Reporting:
|
|||
if cursor_user:
|
||||
cursor_user.close()
|
||||
if cnx_user:
|
||||
cnx_user.disconnect()
|
||||
cnx_user.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND', 'API.USER_PRIVILEGE_NOT_FOUND')
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ class Reporting:
|
|||
if cursor_user:
|
||||
cursor_user.close()
|
||||
if cnx_user:
|
||||
cnx_user.disconnect()
|
||||
cnx_user.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, 'API.NOT_FOUND', 'API.USER_PRIVILEGE_NOT_FOUND')
|
||||
# todo: how to deal with multiple spaces in privilege data
|
||||
|
|
@ -170,7 +170,7 @@ class Reporting:
|
|||
if cursor_user:
|
||||
cursor_user.close()
|
||||
if cnx_user:
|
||||
cnx_user.disconnect()
|
||||
cnx_user.close()
|
||||
|
||||
cnx_system = mysql.connector.connect(**config.myems_system_db)
|
||||
cursor_system = cnx_system.cursor()
|
||||
|
|
@ -183,7 +183,7 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
|
|
@ -236,17 +236,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -583,17 +583,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.DISTRIBUTION_SYSTEM_NOT_FOUND')
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
################################################################################################################
|
||||
# Step 5: query points' data
|
||||
################################################################################################################
|
||||
|
|
@ -152,7 +152,7 @@ class Reporting:
|
|||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.ENERGY_FLOW_DIAGRAM_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -202,7 +202,7 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 5: query reporting period meter energy input
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -166,12 +166,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -209,12 +209,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -215,17 +215,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -463,17 +463,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -673,12 +673,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -215,17 +215,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -477,17 +477,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -469,17 +469,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -215,17 +215,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -444,17 +444,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
equipment = dict()
|
||||
equipment['id'] = row_equipment[0]
|
||||
|
|
@ -214,17 +214,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -465,17 +465,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -215,17 +215,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -444,17 +444,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,22 +163,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -223,22 +223,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -595,22 +595,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
|
||||
|
||||
equipment = dict()
|
||||
|
|
@ -215,17 +215,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -472,17 +472,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Reporting:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -100,7 +100,7 @@ class Reporting:
|
|||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.disconnect()
|
||||
cnx.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 4: construct the report
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -162,12 +162,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -204,12 +204,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -161,22 +161,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_carbon:
|
||||
cursor_carbon.close()
|
||||
if cnx_carbon:
|
||||
cnx_carbon.disconnect()
|
||||
cnx_carbon.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
|
||||
meter = dict()
|
||||
|
|
@ -435,22 +435,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_carbon:
|
||||
cursor_carbon.close()
|
||||
if cnx_carbon:
|
||||
cnx_carbon.disconnect()
|
||||
cnx_carbon.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
result = {
|
||||
"meter": {
|
||||
"cost_center_id": meter['cost_center_id'],
|
||||
|
|
|
|||
|
|
@ -161,22 +161,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
meter = dict()
|
||||
meter['id'] = row_meter[0]
|
||||
|
|
@ -434,22 +434,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
result = {
|
||||
"meter": {
|
||||
"cost_center_id": meter['cost_center_id'],
|
||||
|
|
|
|||
|
|
@ -158,17 +158,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
|
||||
meter = dict()
|
||||
|
|
@ -382,17 +382,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
result = {
|
||||
"meter": {
|
||||
"cost_center_id": meter['cost_center_id'],
|
||||
|
|
|
|||
|
|
@ -80,12 +80,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
|
||||
meter = dict()
|
||||
|
|
@ -198,12 +198,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = {
|
||||
"meter": {
|
||||
|
|
|
|||
|
|
@ -125,12 +125,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -327,12 +327,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
result = {
|
||||
"meter": {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -194,12 +194,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 5: construct the report
|
||||
|
|
|
|||
|
|
@ -121,12 +121,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.METER_NOT_FOUND')
|
||||
meter = dict()
|
||||
meter['id'] = row_meter[0]
|
||||
|
|
@ -256,12 +256,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = {
|
||||
"meter": {
|
||||
|
|
|
|||
|
|
@ -144,17 +144,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
|
|
@ -335,17 +335,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
result = {
|
||||
"offline_meter": {
|
||||
|
|
|
|||
|
|
@ -137,12 +137,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.OFFLINE_METER_NOT_FOUND')
|
||||
|
||||
offline_meter = dict()
|
||||
|
|
@ -276,12 +276,12 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
result = {
|
||||
"offline_meter": {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -166,12 +166,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -209,12 +209,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -478,17 +478,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -492,17 +492,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -484,17 +484,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -481,17 +481,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -164,22 +164,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -225,22 +225,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -610,22 +610,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -160,17 +160,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SHOPFLOOR_NOT_FOUND')
|
||||
|
||||
shopfloor = dict()
|
||||
|
|
@ -216,17 +216,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -486,17 +486,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -520,17 +520,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -243,17 +243,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -579,17 +579,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -540,17 +540,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -221,17 +221,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -527,17 +527,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -501,17 +501,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -481,17 +481,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -501,17 +501,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -166,22 +166,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -227,22 +227,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -681,22 +681,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
|
||||
|
||||
space = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -485,17 +485,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -165,12 +165,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -208,12 +208,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -476,17 +476,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_billing:
|
||||
cursor_billing.close()
|
||||
if cnx_billing:
|
||||
cnx_billing.disconnect()
|
||||
cnx_billing.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -490,17 +490,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -219,17 +219,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_ITEM_NOT_FOUND')
|
||||
|
|
@ -482,17 +482,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -481,17 +481,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -164,22 +164,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -225,22 +225,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -606,22 +606,22 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_energy_baseline:
|
||||
cursor_energy_baseline.close()
|
||||
if cnx_energy_baseline:
|
||||
cnx_energy_baseline.disconnect()
|
||||
cnx_energy_baseline.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.STORE_NOT_FOUND')
|
||||
|
||||
store = dict()
|
||||
|
|
@ -217,17 +217,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
description='API.ENERGY_CATEGORY_NOT_FOUND')
|
||||
|
|
@ -485,17 +485,17 @@ class Reporting:
|
|||
if cursor_system:
|
||||
cursor_system.close()
|
||||
if cnx_system:
|
||||
cnx_system.disconnect()
|
||||
cnx_system.close()
|
||||
|
||||
if cursor_energy:
|
||||
cursor_energy.close()
|
||||
if cnx_energy:
|
||||
cnx_energy.disconnect()
|
||||
cnx_energy.close()
|
||||
|
||||
if cursor_historical:
|
||||
cursor_historical.close()
|
||||
if cnx_historical:
|
||||
cnx_historical.disconnect()
|
||||
cnx_historical.close()
|
||||
|
||||
result = dict()
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.SPACE_NOT_FOUND')
|
||||
else:
|
||||
|
|
@ -166,12 +166,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
raise falcon.HTTPError(falcon.HTTP_404,
|
||||
title='API.NOT_FOUND',
|
||||
|
|
@ -211,12 +211,12 @@ class Reporting:
|
|||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.disconnect()
|
||||
cnx_system_db.close()
|
||||
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.disconnect()
|
||||
cnx_energy_db.close()
|
||||
|
||||
################################################################################################################
|
||||
# Step 6: construct the report
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue