Projekt

Obecné

Profil

« Předchozí | Další » 

Revize e96150c4

Přidáno uživatelem Michal Seják před více než 3 roky(ů)

Re #8476 - Added `to_dict` method to Subject, minor bugfix

Zobrazit rozdíly:

src/model/subject.py
1 1
class Subject:
2
    ATTR_MAP = {"C": "common_name", "ST": "state", "L": "locality", "CN": "common_name", "O": "organization",
2
    ATTR_MAP = {"C": "country", "ST": "state", "L": "locality", "CN": "common_name", "O": "organization",
3 3
                "OU": "organization_unit", "emailAddress": "email_address"}
4
    INVERSE_ATTR_MAP = {k: v for v, k in ATTR_MAP.items()}
4 5

  
5 6
    def __init__(self, common_name=None, country=None, locality=None, state=None, organization=None,
6 7
                 organization_unit=None, email_address=None):
......
25 26
                s.__setattr__(v, d[k])
26 27

  
27 28
        return s
29

  
30
    def to_dict(self):
31
        return {Subject.INVERSE_ATTR_MAP[k]: v for k, v in vars(self).items()}

Také k dispozici: Unified diff