diff options
author | elie <elie> | 2015-01-01 12:27:49 +0000 |
---|---|---|
committer | elie <elie> | 2015-01-01 12:27:49 +0000 |
commit | 164a2773c09b202a9a4257571df966dfaa9c3c92 (patch) | |
tree | 8cc65c01d71975154a7086bcb566539d2348f129 | |
parent | 61d9975ab596676eadb600f4d50a3cd72ca34c57 (diff) | |
download | pyasn1-164a2773c09b202a9a4257571df966dfaa9c3c92.tar.gz |
OctetString.prettyOut non-printables detection improved
-rw-r--r-- | pyasn1/type/univ.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index d623c7f..fa992ff 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -402,13 +402,13 @@ class OctetString(base.AbstractSimpleAsn1Item): def prettyOut(self, value): if sys.version_info[0] <= 2: - numbers = tuple([ ord(x) for x in value ]) + numbers = tuple(( ord(x) for x in value )) else: numbers = tuple(value) - if [ x for x in numbers if x < 32 or x > 126 ]: - return '0x' + ''.join([ '%.2x' % x for x in numbers ]) - else: + if all(x < 32 or x > 126 for x in numbers): return str(value) + else: + return '0x' + ''.join(( '%.2x' % x for x in numbers )) def __repr__(self): r = [] |