X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ctypescrypto%2Foid.py;h=8caa57a68ad766c94cb79b4d40ad99042939e113;hb=ec92bf04b008b0401014cae90fa2dfca18efa02c;hp=6941ce4b399b6b353026dfa99aac02238b656e5e;hpb=4367362775bc1936c63cb0bff16a71affc31f8a2;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))