Revize c62151d4
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
57 | 57 |
:raises InvalidCertificateAttribute: When a subject with an invalid attribute is passed |
58 | 58 |
""" |
59 | 59 |
if subject.country is not None and len(subject.country) != 2: |
60 |
raise InvalidSubjectAttribute("Country code", "Must consist of exactly 2 letters.")
|
|
60 |
raise InvalidSubjectAttribute("Country code", "Must consist of exactly 2 letters") |
|
61 | 61 |
|
62 | 62 |
# TODO usages present in method parameters but not in class diagram |
63 | 63 |
def create_root_ca(self, key: PrivateKey, subject: Subject, extensions: str = "", config: str = "", |
... | ... | |
637 | 637 |
self.reason = reason |
638 | 638 |
|
639 | 639 |
def __str__(self): |
640 |
return f"""Subject attribute "{self.attribute_name} is invalid (reason: {self.reason}).""" |
|
640 |
return f"""Subject attribute "{self.attribute_name}" is invalid (reason: {self.reason}).""" |
Také k dispozici: Unified diff
Improved InvalidSubjectAttribute string representation and added an "except" block in CertificateController that handles this error.