Projekt

Obecné

Profil

« Předchozí | Další » 

Revize bb4a9d1f

Přidáno uživatelem Michal Seják před téměř 4 roky(ů)

Re #8702 - Updated Certificate constructors in compliance with the recent database updates.

Zobrazit rozdíly:

src/dao/certificate_repository.py
272 272
            values += list(target_usages)
273 273

  
274 274
            sql = (
275
                f"SELECT a.{COL_ID}, {COL_COMMON_NAME}, {COL_VALID_FROM}, {COL_VALID_TO}, {COL_PEM_DATA}, "
276
                f"{COL_REVOCATION_DATE}, {COL_REVOCATION_REASON}, {COL_PRIVATE_KEY_ID}, {COL_TYPE_ID}, {COL_PARENT_ID} "
275
                f"SELECT * "
277 276
                f"FROM {TAB_CERTIFICATES} a "
278 277
                f"WHERE (a.{COL_DELETION_DATE} IS NULL OR a.{COL_DELETION_DATE} = '') "
279 278
                f"AND a.{COL_TYPE_ID} IN ({','.join('?' * len(target_types))}) "
......
306 305
                for usage_row in usage_rows:
307 306
                    usage_dict[usage_row[0]] = True
308 307

  
309
                certificates.append(Certificate(certificate_row[0],
310
                                                certificate_row[1],
311
                                                certificate_row[2],
312
                                                certificate_row[3],
313
                                                certificate_row[4],
314
                                                certificate_row[7],
315
                                                certificate_row[8],
316
                                                certificate_row[9],
308
                certificates.append(Certificate(certificate_row[0],  # ID
309
                                                certificate_row[1],  # valid from
310
                                                certificate_row[2],  # valid to
311
                                                certificate_row[3],  # pem data
312
                                                certificate_row[14],  # type ID
313
                                                certificate_row[15],  # parent ID
314
                                                certificate_row[16],  # private key ID
317 315
                                                usage_dict,
318
                                                certificate_row[5],
319
                                                certificate_row[6]))
316
                                                certificate_row[4],  # common name
317
                                                certificate_row[5],  # country code
318
                                                certificate_row[6],  # locality
319
                                                certificate_row[7],  # province
320
                                                certificate_row[8],  # organization
321
                                                certificate_row[9],  # organizational unit
322
                                                certificate_row[10],  # email address
323
                                                certificate_row[11],  # revocation date
324
                                                certificate_row[12]))  # revocation reason
320 325
        except IntegrityError:
321 326
            Logger.error(INTEGRITY_ERROR_MSG)
322 327
            raise DatabaseException(INTEGRITY_ERROR_MSG)
......
726 731
            values += list(target_usages)
727 732

  
728 733
            sql = (
729
                f"SELECT a.{COL_ID}, {COL_COMMON_NAME}, {COL_VALID_FROM}, {COL_VALID_TO}, {COL_PEM_DATA}, "
730
                f"{COL_REVOCATION_DATE}, {COL_REVOCATION_REASON}, {COL_PRIVATE_KEY_ID}, {COL_TYPE_ID}, {COL_PARENT_ID} "
734
                f"SELECT * "
731 735
                f"FROM {TAB_CERTIFICATES} a "
732 736
                f"WHERE (a.{COL_DELETION_DATE} IS NULL OR a.{COL_DELETION_DATE} = '') "
733 737
                f"AND a.{COL_PARENT_ID} = ? AND a.{COL_ID} != ? "
......
761 765
                for usage_row in usage_rows:
762 766
                    usage_dict[usage_row[2]] = True
763 767

  
764
                certificates.append(Certificate(certificate_row[0],
765
                                                certificate_row[1],
766
                                                certificate_row[2],
767
                                                certificate_row[3],
768
                                                certificate_row[4],
769
                                                certificate_row[7],
770
                                                certificate_row[8],
771
                                                certificate_row[9],
768
                certificates.append(Certificate(certificate_row[0],  # ID
769
                                                certificate_row[1],  # valid from
770
                                                certificate_row[2],  # valid to
771
                                                certificate_row[3],  # pem data
772
                                                certificate_row[14],  # type ID
773
                                                certificate_row[15],  # parent ID
774
                                                certificate_row[16],  # private key ID
772 775
                                                usage_dict,
773
                                                certificate_row[5],
774
                                                certificate_row[6]))
776
                                                certificate_row[4],  # common name
777
                                                certificate_row[5],  # country code
778
                                                certificate_row[6],  # locality
779
                                                certificate_row[7],  # province
780
                                                certificate_row[8],  # organization
781
                                                certificate_row[9],  # organizational unit
782
                                                certificate_row[10],  # email address
783
                                                certificate_row[11],  # revocation date
784
                                                certificate_row[12]))  # revocation reason
775 785
        except IntegrityError:
776 786
            Logger.error(INTEGRITY_ERROR_MSG)
777 787
            raise DatabaseException(INTEGRITY_ERROR_MSG)

Také k dispozici: Unified diff