def mktype(typecode, modulename=None): if modulename: module = __import__(modulename) codenamemapper = module._classdeclarations classtype = codenamemapper.get(typecode, None) if classtype: return classtype return aetypes.mktype(typecode)
def mkobjectfrommodule(dict, modulename): if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): classtype = dict['want'] dict['want'] = aetypes.mktype(classtype.want) want = dict['want'].type module = __import__(modulename) codenamemapper = module._classdeclarations classtype = codenamemapper.get(want, None) newobj = mkobject(dict) if not (classtype and issubclass(classtype, ObjectSpecifier)): raise AssertionError newobj.__class__ = classtype return newobj
def mkobjectfrommodule(dict, modulename): if type(dict['want']) == types.ClassType and issubclass( dict['want'], ObjectSpecifier): classtype = dict['want'] dict['want'] = aetypes.mktype(classtype.want) want = dict['want'].type module = __import__(modulename) codenamemapper = module._classdeclarations classtype = codenamemapper.get(want, None) newobj = mkobject(dict) if classtype: newobj.__class__ = classtype return newobj
def mkobjectfrommodule(dict, modulename): if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): # The type has already been converted to Python. Convert back:-( classtype = dict['want'] dict['want'] = aetypes.mktype(classtype.want) want = dict['want'].type module = __import__(modulename) codenamemapper = module._classdeclarations classtype = codenamemapper.get(want, None) newobj = mkobject(dict) if classtype: assert issubclass(classtype, ObjectSpecifier) newobj.__class__ = classtype return newobj
"""Tools for use in AppleEvent clients and servers: