@@ 202-224 (lines=23) @@ | ||
199 | " FROM tbl_energy_categories " |
|
200 | " ORDER BY id ", ) |
|
201 | rows_energy_categories = cursor_system.fetchall() |
|
202 | if rows_energy_categories is None or len(rows_energy_categories) == 0: |
|
203 | if cursor_system: |
|
204 | cursor_system.close() |
|
205 | if cnx_system: |
|
206 | cnx_system.disconnect() |
|
207 | ||
208 | if cursor_energy: |
|
209 | cursor_energy.close() |
|
210 | if cnx_energy: |
|
211 | cnx_energy.disconnect() |
|
212 | ||
213 | if cursor_energy_baseline: |
|
214 | cursor_energy_baseline.close() |
|
215 | if cnx_energy_baseline: |
|
216 | cnx_energy_baseline.disconnect() |
|
217 | ||
218 | if cnx_historical: |
|
219 | cnx_historical.close() |
|
220 | if cursor_historical: |
|
221 | cursor_historical.disconnect() |
|
222 | raise falcon.HTTPError(falcon.HTTP_404, |
|
223 | title='API.NOT_FOUND', |
|
224 | description='API.ENERGY_CATEGORY_NOT_FOUND') |
|
225 | energy_category_dict = dict() |
|
226 | for row_energy_category in rows_energy_categories: |
|
227 | if row_energy_category[0] in energy_category_set: |
|
@@ 141-161 (lines=21) @@ | ||
138 | " FROM tbl_spaces " |
|
139 | " WHERE id = %s ", (space_id,)) |
|
140 | row_space = cursor_system.fetchone() |
|
141 | if row_space is None: |
|
142 | if cursor_system: |
|
143 | cursor_system.close() |
|
144 | if cnx_system: |
|
145 | cnx_system.disconnect() |
|
146 | ||
147 | if cursor_energy: |
|
148 | cursor_energy.close() |
|
149 | if cnx_energy: |
|
150 | cnx_energy.disconnect() |
|
151 | ||
152 | if cursor_energy_baseline: |
|
153 | cursor_energy_baseline.close() |
|
154 | if cnx_energy_baseline: |
|
155 | cnx_energy_baseline.disconnect() |
|
156 | ||
157 | if cnx_historical: |
|
158 | cnx_historical.close() |
|
159 | if cursor_historical: |
|
160 | cursor_historical.disconnect() |
|
161 | raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND') |
|
162 | ||
163 | space = dict() |
|
164 | space['id'] = row_space[0] |
@@ 200-222 (lines=23) @@ | ||
197 | " FROM tbl_energy_categories " |
|
198 | " ORDER BY id ", ) |
|
199 | rows_energy_categories = cursor_system.fetchall() |
|
200 | if rows_energy_categories is None or len(rows_energy_categories) == 0: |
|
201 | if cursor_system: |
|
202 | cursor_system.close() |
|
203 | if cnx_system: |
|
204 | cnx_system.disconnect() |
|
205 | ||
206 | if cursor_energy: |
|
207 | cursor_energy.close() |
|
208 | if cnx_energy: |
|
209 | cnx_energy.disconnect() |
|
210 | ||
211 | if cursor_energy_baseline: |
|
212 | cursor_energy_baseline.close() |
|
213 | if cnx_energy_baseline: |
|
214 | cnx_energy_baseline.disconnect() |
|
215 | ||
216 | if cnx_historical: |
|
217 | cnx_historical.close() |
|
218 | if cursor_historical: |
|
219 | cursor_historical.disconnect() |
|
220 | raise falcon.HTTPError(falcon.HTTP_404, |
|
221 | title='API.NOT_FOUND', |
|
222 | description='API.ENERGY_CATEGORY_NOT_FOUND') |
|
223 | energy_category_dict = dict() |
|
224 | for row_energy_category in rows_energy_categories: |
|
225 | if row_energy_category[0] in energy_category_set: |
|
@@ 139-159 (lines=21) @@ | ||
136 | " FROM tbl_tenants " |
|
137 | " WHERE id = %s ", (tenant_id,)) |
|
138 | row_tenant = cursor_system.fetchone() |
|
139 | if row_tenant is None: |
|
140 | if cursor_system: |
|
141 | cursor_system.close() |
|
142 | if cnx_system: |
|
143 | cnx_system.disconnect() |
|
144 | ||
145 | if cursor_energy: |
|
146 | cursor_energy.close() |
|
147 | if cnx_energy: |
|
148 | cnx_energy.disconnect() |
|
149 | ||
150 | if cursor_energy_baseline: |
|
151 | cursor_energy_baseline.close() |
|
152 | if cnx_energy_baseline: |
|
153 | cnx_energy_baseline.disconnect() |
|
154 | ||
155 | if cnx_historical: |
|
156 | cnx_historical.close() |
|
157 | if cursor_historical: |
|
158 | cursor_historical.disconnect() |
|
159 | raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.TENANT_NOT_FOUND') |
|
160 | ||
161 | tenant = dict() |
|
162 | tenant['id'] = row_tenant[0] |