Code Duplication    Length = 11-11 lines in 4 locations

core/space.py 2 locations

@@ 635-645 (lines=11) @@
632
            cnx.disconnect()
633
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
634
                                   description='API.TIMEZONE_NOT_FOUND')
635
        if contact_id is not None:
636
            cursor.execute(" SELECT name "
637
                           " FROM tbl_contacts "
638
                           " WHERE id = %s ",
639
                           (new_values['data']['contact_id'],))
640
            row = cursor.fetchone()
641
            if row is None:
642
                cursor.close()
643
                cnx.disconnect()
644
                raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
645
                                       description='API.CONTACT_NOT_FOUND')
646
647
        if cost_center_id is not None:
648
            cursor.execute(" SELECT name "
@@ 211-221 (lines=11) @@
208
            cnx.disconnect()
209
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
210
                                   description='API.TIMEZONE_NOT_FOUND')
211
        if contact_id is not None:
212
            cursor.execute(" SELECT name "
213
                           " FROM tbl_contacts "
214
                           " WHERE id = %s ",
215
                           (new_values['data']['contact_id'],))
216
            row = cursor.fetchone()
217
            if row is None:
218
                cursor.close()
219
                cnx.disconnect()
220
                raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
221
                                       description='API.CONTACT_NOT_FOUND')
222
223
        if cost_center_id is not None:
224
            cursor.execute(" SELECT name "

core/shopfloor.py 2 locations

@@ 471-481 (lines=11) @@
468
            raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
469
                                   description='API.SHOPFLOOR_NAME_IS_ALREADY_IN_USE')
470
471
        if contact_id is not None:
472
            cursor.execute(" SELECT name "
473
                           " FROM tbl_contacts "
474
                           " WHERE id = %s ",
475
                           (new_values['data']['contact_id'],))
476
            row = cursor.fetchone()
477
            if row is None:
478
                cursor.close()
479
                cnx.disconnect()
480
                raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
481
                                       description='API.CONTACT_NOT_FOUND')
482
483
        if cost_center_id is not None:
484
            cursor.execute(" SELECT name "
@@ 150-160 (lines=11) @@
147
            raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
148
                                   description='API.SHOPFLOOR_NAME_IS_ALREADY_IN_USE')
149
150
        if contact_id is not None:
151
            cursor.execute(" SELECT name "
152
                           " FROM tbl_contacts "
153
                           " WHERE id = %s ",
154
                           (new_values['data']['contact_id'],))
155
            row = cursor.fetchone()
156
            if row is None:
157
                cursor.close()
158
                cnx.disconnect()
159
                raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
160
                                       description='API.CONTACT_NOT_FOUND')
161
162
        if cost_center_id is not None:
163
            cursor.execute(" SELECT name "