quantmind/pulsar — pull request #129 by axisofentropy (2014-09-10 02:21:58+00:00)
Title: Allow AttributeDictionaries to be pickled.

I began a WebSocket example on my workstation, which is Ubuntu 13.10 with Python 2.7.5. I got this Traceback that goes into the `pickle` stdlib:

```
Traceback (most recent call last):
File "/home/adam/src/.../director.py", line 34, in
d.startup()
File "/home/adam/src/.../director.py", line 29, in startup
wsgi.WSGIServer(callable=self.pulsar_app).start()
File "/usr/local/lib/python2.7/dist-packages/pulsar/apps/__init__.py", line 357, in start
on_start = self()
File "/usr/local/lib/python2.7/dist-packages/pulsar/apps/__init__.py", line 463, in __call__
actor = pulsar.arbiter(cfg=self.cfg.clone())
File "/usr/local/lib/python2.7/dist-packages/pulsar/utils/config.py", line 356, in clone
serialized_self = pickle.dumps(self)
File "/usr/lib/python2.7/copy_reg.py", line 84, in _reduce_ex
dict = getstate()
TypeError: 'NoneType' object is not callable
```

It looks like the AttributeDictionary didn't inherit the __getstate__ and __setstate__ methods from collections.Mapping. This might not apply to other versions of Python, but I added those methods and it works for me now.