diff options
author | elie <elie> | 2015-09-10 19:59:23 +0000 |
---|---|---|
committer | elie <elie> | 2015-09-10 19:59:23 +0000 |
commit | 6a26d80831a37e1d2f142cafc83763e234523ed1 (patch) | |
tree | 07061039fe5e304f9e9b6f8d07914e804db21355 /pyasn1 | |
parent | f8de0e370466ec8e4e81915e82fae4888f966586 (diff) | |
download | pyasn1-6a26d80831a37e1d2f142cafc83763e234523ed1.tar.gz |
fix to ObjectIdentifier initialization from unicode string
Diffstat (limited to 'pyasn1')
-rw-r--r-- | pyasn1/compat/octets.py | 2 | ||||
-rw-r--r-- | pyasn1/type/univ.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/pyasn1/compat/octets.py b/pyasn1/compat/octets.py index f7f2a29..e812737 100644 --- a/pyasn1/compat/octets.py +++ b/pyasn1/compat/octets.py @@ -9,6 +9,7 @@ if version_info[0] <= 2: str2octs = lambda x: x octs2str = lambda x: x isOctetsType = lambda s: isinstance(s, str) + isStringType = lambda s: isinstance(s, (str, unicode)) else: ints2octs = bytes int2oct = lambda x: ints2octs((x,)) @@ -18,3 +19,4 @@ else: str2octs = lambda x: x.encode() octs2str = lambda x: x.decode() isOctetsType = lambda s: isinstance(s, bytes) + isStringType = lambda s: isinstance(s, str) diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index f4bff81..4ed640f 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -533,7 +533,7 @@ class ObjectIdentifier(base.AbstractSimpleAsn1Item): pass elif isinstance(value, ObjectIdentifier): return tuple(value) - elif isinstance(value, str): + elif octets.isStringType(value): r = [] for element in [ x for x in value.split('.') if x != '' ]: try: |