diff options
-rw-r--r-- | rpkid/rpki/rcynic.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rpkid/rpki/rcynic.py b/rpkid/rpki/rcynic.py index b7e493ec..b05586ff 100644 --- a/rpkid/rpki/rcynic.py +++ b/rpkid/rpki/rcynic.py @@ -3,8 +3,6 @@ Prototype of an iterator class to parse the output of an rcynic run. This script will almost certainly move to the library package once it's stable. -$Id$ - Copyright (C) 2010-2011 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any @@ -20,6 +18,8 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ +__revision__ = '$Id$' + import sys, os, rpki.x509, rpki.exceptions from xml.etree.ElementTree import ElementTree @@ -189,8 +189,12 @@ class rcynic_file_iterator(object): class validation_status_element(object): def __init__(self, *args, **kwargs): + self.attrs = [] for k,v in kwargs.iteritems(): setattr(self, k, v) + # attribute names are saved so that the __repr__ method can + # display the subset of attributes the user specified + self.attrs.append(k) self._obj = None def get_obj(self): @@ -198,6 +202,11 @@ class validation_status_element(object): self._obj = self.file_class(filename=self.filename, uri=self.uri) return self._obj + def __repr__(self): + v = [self.__class__.__name__, 'id=%s' % str(id(self))] + v.extend(['%s=%s' % (x, getattr(self, x)) for x in self.attrs]) + return '<%s>' % (' '.join(v),) + obj = property(get_obj) class rcynic_xml_iterator(object): |