def failure(str): print("failed", str) sresp = zdefs.SearchResponse() sresp.resultCount = 0 sresp.numberOfRecordsReturned = 0 sresp.nextResultSetPosition = 1 sresp.searchStatus = 0 self.send_PDU('searchResponse', sresp)
def eb(err): sresp = zdefs.SearchResponse() sresp.searchStatus = 0 # boolean sresp.numberOfRecordsReturned = 1 sresp.resultCount = 0 sresp.nextResultSetPosition = 0 self.set_diagrec(err, sresp) self.send_PDU('searchResponse', sresp)
def cb(l): self.result_sets[sreq.resultSetName] = l sresp = zdefs.SearchResponse() sresp.resultCount = len(l) sresp.numberOfRecordsReturned = 0 sresp.nextResultSetPosition = 1 sresp.searchStatus = 1 sresp.presentStatus = zdefs.PresentStatus.get_num_from_name( 'success') self.send_PDU('searchResponse', sresp)
def success(val): print("val len", len(val)) try: def strify_dict(bag): d = bag.__dict__ def represent(s): if isinstance(s, str): return s if isinstance(s, amazon.Bag): return strify_dict(s) if isinstance(s, str): try: return s.encode('ascii') except UnicodeError: pass return repr(s) # Unicode, and catch-all return [ "%s: %s" % (t[0], represent(t[1])) for t in list(d.items()) ] string_list = ["\n".join(strify_dict(x)) for x in val] self.result_sets[sreq.resultSetName] = string_list print("creating resp", repr(sreq.resultSetName), self, self.result_sets) sresp = zdefs.SearchResponse() print("resp created") sresp.resultCount = len(string_list) print("result count", sresp.resultCount) sresp.numberOfRecordsReturned = 0 sresp.nextResultSetPosition = 1 print("setting search status") sresp.searchStatus = 1 print("setting presentStatus") sresp.presentStatus = zdefs.PresentStatus.get_num_from_name( 'success') print("about to send") self.send_PDU('searchResponse', sresp) except Exception as e: print("Exception:", e) raise