Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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
Exemple #4
0
 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
Exemple #5
0
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)
Exemple #6
0
 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()
Exemple #7
0
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)
Exemple #8
0
 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()
Exemple #9
0
 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)
Exemple #10
0
 def testHttpBinServer(self):
     from examples.httpbin.manage import server
     app = server(bind='127.0.0.1:0')
     app2 = pickle.loads(pickle.dumps(app))
Exemple #11
0
 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)
Exemple #12
0
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)
Exemple #13
0
 def testHttpBinServer(self):
     from examples.httpbin.manage import server
     app = server(bind='127.0.0.1:0')
     app2 = pickle.loads(pickle.dumps(app))
Exemple #14
0
 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)
Exemple #15
0
 def testRemote(self):
     failure = maybe_failure(Exception("testRemote"))
     failure.logged = True
     remote = pickle.loads(pickle.dumps(failure))
     self.assertTrue(remote.logged)