def __test_pickle(self): # TODO: this fails at times a = AttributeDictionary() a['ciao'] = 5 b = pickle.dumps(a) c = pickle.loads(b) self.assertEqual(a, c)
def to_python(self, value, store=None): if value is not None: if store: value = store.decode_bytes(value) if isinstance(value, bytes): return pickle.loads(value) else: return value
def monitor_params(self, params=None): app = self.app if self.cfg.concurrency == 'thread': app = pickle.loads(pickle.dumps(app)) params.update({'app': app, 'name': '{0}-worker'.format(app.name), 'start': worker_start}) app.actorparams(self, params)
def data_received(self, data): # Feed data into the parser msg = self._parser.decode(data) while msg: try: message = pickle.loads(msg.body) except Exception as e: raise ProtocolError('Could not decode message body: %s' % e) self._on_message(message) msg = self._parser.decode()
def monitor_params(self, params=None): app = self.app if self.cfg.concurrency == 'thread': app = pickle.loads(pickle.dumps(app)) params.update({ 'app': app, 'name': '{0}-worker'.format(app.name), 'start': worker_start }) app.actorparams(self, params)
def data_received(self, data): # Feed data into the parser msg = self._parser.decode(data) while msg: try: message = pickle.loads(msg.body) except Exception as e: raise ProtocolError('Could not decode message body: %s' % e) maybe_async(self._responde(message), event_loop=self.event_loop) msg = self._parser.decode()
def testRemoteExcInfo(self): failure = maybe_failure(Exception("testRemoteExcInfo")) remote = pickle.loads(pickle.dumps(failure)) # Now create a failure from the remote.exc_info failure2 = maybe_failure(remote.exc_info) self.assertEqual(failure2.exc_info, remote.exc_info) self.assertFalse(failure.logged) self.assertFalse(failure2.logged) mute_failure(self, failure) mute_failure(self, remote)
def testHttpBinServer(self): from examples.httpbin.manage import server app = server(bind='127.0.0.1:0') app2 = pickle.loads(pickle.dumps(app))
def testWsgiHandler(self): hnd = wsgi.WsgiHandler(middleware=(wsgi.authorization_middleware,)) self.assertEqual(len(hnd.middleware), 1) hnd2 = pickle.loads(pickle.dumps(hnd)) self.assertEqual(len(hnd2.middleware), 1)
def monitor_params(self, params=None): app = self.app if self.cfg.concurrency == "thread": app = pickle.loads(pickle.dumps(app)) params.update({"app": app, "name": "{0}-worker".format(app.name), "start": worker_start}) app.actorparams(self, params)
def testWsgiHandler(self): hnd = wsgi.WsgiHandler(middleware=(wsgi.authorization_middleware, )) self.assertEqual(len(hnd.middleware), 1) hnd2 = pickle.loads(pickle.dumps(hnd)) self.assertEqual(len(hnd2.middleware), 1)
def testRemote(self): failure = maybe_failure(Exception("testRemote")) failure.logged = True remote = pickle.loads(pickle.dumps(failure)) self.assertTrue(remote.logged)