def get_page(self, url, post, headers, data): """ A method which is supposed to act like a limited version of L{landscape.lib.fetch.fetch}. Record attempts to get pages, and return a deferred with pre-cooked data. """ self.fetches.append((url, post, headers, data)) return bpickle.dumps(self.response)
def render_messages(messages, computer=None, ping_answer=False): """Updates the answer with the server-uuid, pickles it and returns the HttpReponse. """ ret = {'messages': messages} if not ping_answer: ret.update({'server-uuid': SERVER_UUID}) if computer: ret.update({ 'client-accepted-types-hash': computer.client_accepted_types_hash.decode('hex'), 'next-expected-sequence': computer.next_client_sequence}) return HttpResponse(dumps(ret))