Revize 805077f5
Přidáno uživatelem David Friesecký před asi 4 roky(ů)
src/dao/certificate_repository.py | ||
---|---|---|
18 | 18 |
self.connection = connection |
19 | 19 |
self.cursor = cursor |
20 | 20 |
|
21 |
def create(self, certificate: Certificate) -> bool:
|
|
21 |
def create(self, certificate: Certificate): |
|
22 | 22 |
""" |
23 | 23 |
Creates a certificate. |
24 | 24 |
For root certificate (CA) the parent certificate id is modified to the same id (id == parent_id). |
... | ... | |
65 | 65 |
self.connection.commit() |
66 | 66 |
except Error as e: |
67 | 67 |
print(e) |
68 |
return False
|
|
68 |
return None
|
|
69 | 69 |
|
70 |
return True
|
|
70 |
return last_id
|
|
71 | 71 |
|
72 |
def read(self, certificate_id: int) -> Certificate:
|
|
72 |
def read(self, certificate_id: int): |
|
73 | 73 |
""" |
74 | 74 |
Reads (selects) a certificate. |
75 | 75 |
|
... | ... | |
107 | 107 |
print(e) |
108 | 108 |
return None |
109 | 109 |
|
110 |
return certificate |
|
110 |
if len(certificate_row) > 0: |
|
111 |
return certificate |
|
112 |
else: |
|
113 |
return None |
|
111 | 114 |
|
112 | 115 |
def update(self, certificate_id: int, certificate: Certificate) -> bool: |
113 | 116 |
""" |
... | ... | |
137 | 140 |
certificate.pem_data, |
138 | 141 |
certificate.private_key_id, |
139 | 142 |
certificate.type_id, |
140 |
certificate.parent_id] |
|
143 |
certificate.parent_id, |
|
144 |
certificate_id] |
|
141 | 145 |
self.cursor.execute(sql, values) |
142 | 146 |
self.connection.commit() |
143 | 147 |
|
Také k dispozici: Unified diff
Re #8471 - Error correction after review