summaryrefslogtreecommitdiff
path: root/pyasn1/type/tag.py
diff options
context:
space:
mode:
authorelie <elie>2014-06-13 08:45:49 +0000
committerelie <elie>2014-06-13 08:45:49 +0000
commit599c9614614b48a45b6d51d9f7288c44b791b5c2 (patch)
tree6a544f0fc8a47565d6092931a258c69e51d8c86c /pyasn1/type/tag.py
parentfa9bdec43d966aca2b5dc5d42bff6ddc904a19a2 (diff)
downloadpyasn1-599c9614614b48a45b6d51d9f7288c44b791b5c2.tar.gz
* new prettyPrintType() abstract method implemented to base pyasn1 types
to facilitate encoding errors analisys. * the __str__() method implemented to Tag, TagSet and TagMap classes to ease encoding errors troubleshooting.
Diffstat (limited to 'pyasn1/type/tag.py')
-rw-r--r--pyasn1/type/tag.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pyasn1/type/tag.py b/pyasn1/type/tag.py
index 18b6559..7471a9b 100644
--- a/pyasn1/type/tag.py
+++ b/pyasn1/type/tag.py
@@ -24,6 +24,9 @@ class Tag:
self.uniq = (tagClass, tagId)
self.__hashedUniqTag = hash(self.uniq)
+ def __str__(self):
+ return '[%s:%s:%s]' % self.__tag
+
def __repr__(self):
return '%s(tagClass=%s, tagFormat=%s, tagId=%s)' % (
(self.__class__.__name__,) + self.__tag
@@ -62,7 +65,10 @@ class TagSet:
_uniq = _uniq + t.uniq
self.uniq = _uniq
self.__lenOfSuperTags = len(superTags)
-
+
+ def __str__(self):
+ return self.__superTags and '+'.join([str(x) for x in self.__superTags]) or '[untagged]'
+
def __repr__(self):
return '%s(%s)' % (
self.__class__.__name__,