Index: plaso/containers/interface.py |
diff --git a/plaso/containers/interface.py b/plaso/containers/interface.py |
index 5df1464bd910ed2fc9552cd20c54737c52185602..199a357dced588b5b3ea7767f147d70c6c58961e 100644 |
--- a/plaso/containers/interface.py |
+++ b/plaso/containers/interface.py |
@@ -1,6 +1,8 @@ |
# -*- coding: utf-8 -*- |
"""The attribute container interface.""" |
+from plaso.lib import py2to3 |
+ |
from efilter.protocols import structured |
@@ -84,6 +86,28 @@ class AttributeContainer(object): |
yield attribute_name, attribute_value |
+ def GetAttributeValuesString(self): |
+ """Retrieves a comparable string of the attribute values. |
+ |
+ Returns: |
+ int: comparable string of the attribute values. |
+ """ |
+ attributes = [] |
+ for attribute_name, attribute_value in sorted(self.__dict__.items()): |
+ if attribute_name.startswith(u'_') or attribute_value is None: |
+ continue |
+ |
+ if isinstance(attribute_value, dict): |
+ attribute_value = sorted(attribute_value.items()) |
+ |
+ elif isinstance(attribute_value, py2to3.BYTES_TYPE): |
+ attribute_value = repr(attribute_value) |
+ |
+ attribute_string = u'{0:s}: {1!s}'.format(attribute_name, attribute_value) |
+ attributes.append(attribute_string) |
+ |
+ return u', '.join(attributes) |
+ |
def GetIdentifier(self): |
"""Retrieves the identifier. |