diff options
author | Joshua Tauberer <jt@occams.info> | 2015-07-06 22:37:53 +0000 |
---|---|---|
committer | Joshua Tauberer <jt@occams.info> | 2015-07-06 23:01:22 +0000 |
commit | d2afad325e2e9c52765b4a696d6f6b646c4e855b (patch) | |
tree | 9b8310e2668800dbb20bcb191b8a830d0a0e2f3b /src | |
parent | 18b6fc84fcb671412aaaf453f623a44a30a1a2a3 (diff) | |
download | cryptography-d2afad325e2e9c52765b4a696d6f6b646c4e855b.tar.gz cryptography-d2afad325e2e9c52765b4a696d6f6b646c4e855b.tar.bz2 cryptography-d2afad325e2e9c52765b4a696d6f6b646c4e855b.zip |
special-case GeneralNames.get_values_for_type to return OtherName instances directly rather than their value properties; tests updated
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index 48949b61..c9d0c260 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -1090,7 +1090,13 @@ class GeneralNames(object): return len(self._general_names) def get_values_for_type(self, type): - return [i.value for i in self if isinstance(i, type)] + # Return the value of each GeneralName, except for OtherName instances + # which we return directly because it has two important properties not + # just one value. + objs = (i for i in self if isinstance(i, type)) + if type != OtherName: + objs = (i.value for i in objs) + return list(objs) def __repr__(self): return "<GeneralNames({0})>".format(self._general_names) |