From 53d8d49454d7cef5cd41fc854116090ca78026ce Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 13 Feb 2015 18:47:30 -0600 Subject: make x509.Name iterable and address other review feedback --- src/cryptography/x509.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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") -- cgit v1.2.3