gweis/isodate — pull request #10 by jeremycline (2014-08-01 12:46:15+00:00)
Title: Fixed an infinite recursive loop in Duration when pickling

Hi,

This pull request makes Duration capable of being pickled and copied. Currently, in Python 2.7, attempting to do

```python
from isodate import Duration
import pickle

dur = Duration(months=1)
pickled_dur = pickle.dumps(dur)
unpickled_dur = pickle.loads(pickled_dur)
```
results in a RuntimeError when calling ```pickle.loads```.

This occurs because, when recreating an object, pickle does not call ```__init__```. Instead, it calls ```__new__``` directly, and then looks for the ```__setstate__``` method. It calls ```__getattr__``` to do this. Unfortunately, ```__getattr__``` references ```self.tdelta```, and since ```__init__``` was never called, this leads to ```__getattr__``` calling ```__getattr__``` until the maximum recursion depth is reached. This PR just adds a check to make sure ```__getattr__``` raises an AttributeError if it's being called to retrieve ```tdelta```.