X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ctypescrypto%2Foid.py;h=8caa57a68ad766c94cb79b4d40ad99042939e113;hb=ca6a5055ad8a9ea82e9f42aff3c906903d5e6df7;hp=6941ce4b399b6b353026dfa99aac02238b656e5e;hpb=7b9c29e43612629052e0ec875fd9ecbb35b0b02d;p=oss%2Fctypescrypto.git diff --git a/ctypescrypto/oid.py b/ctypescrypto/oid.py index 6941ce4..8caa57a 100644 --- a/ctypescrypto/oid.py +++ b/ctypescrypto/oid.py @@ -29,11 +29,13 @@ class Oid(object): def __init__(self,value): " Object constuctor. Accepts string or integer" - if type(value) == type(""): + if isinstance(value,unicode): + value=value.encode('ascii') + if isinstance(value,str): self.nid=libcrypto.OBJ_txt2nid(value) if self.nid==0: raise ValueError("Cannot find object %s in the database"%(value)) - elif type(value) == type(0): + elif isinstance(value,(int,long)): cn=libcrypto.OBJ_nid2sn(value) if cn is None: raise ValueError("No such nid %d in the database"%(value))