def packdict(self, val): record = newrecord() usrf = None for key, value in val.items(): if isinstance(key, (AEType, AEProp)): if key.code == 'pcls': # AS packs records that contain a 'class' property by coercing the packed record to that type at the end try: record = record.coerce(value.code) except: record.setparam(key.code, self.pack(value)) else: record.setparam(key.code, self.pack(value)) else: if not usrf: usrf = newlist() usrf.setitem(0, self.pack(key)) usrf.setitem(0, self.pack(value)) if usrf: record.setparam('usrf', usrf) return record
def packlistas(type, lst): desc = ae.newrecord().coerce(type) for key, value in lst: desc.setparam(key, value) return desc