aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-02-13 18:47:30 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-02-13 18:47:30 -0600
commit53d8d49454d7cef5cd41fc854116090ca78026ce (patch)
tree44378de0bb36ce16c208856504a897064102b1c5 /src
parente901d642548dd268dcdc2efa60087a3fa1774fa6 (diff)
downloadcryptography-53d8d49454d7cef5cd41fc854116090ca78026ce.tar.gz
cryptography-53d8d49454d7cef5cd41fc854116090ca78026ce.tar.bz2
cryptography-53d8d49454d7cef5cd41fc854116090ca78026ce.zip
make x509.Name iterable and address other review feedback
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 7eb9a608..21693ed4 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -111,19 +111,21 @@ class Name(object):
def get_attributes_for_oid(self, oid):
return [i for i in self._attributes if i.oid == oid]
- @property
- def attributes(self):
- return self._attributes[:]
-
def __eq__(self, other):
if not isinstance(other, Name):
return NotImplemented
- return self.attributes == other.attributes
+ return self._attributes == other._attributes
def __ne__(self, other):
return not self == other
+ def __iter__(self):
+ return iter(self._attributes[:])
+
+ def __len__(self):
+ return len(self._attributes)
+
OID_COMMON_NAME = ObjectIdentifier("2.5.4.3")
OID_COUNTRY_NAME = ObjectIdentifier("2.5.4.6")