Document the __getstate__ and __setstate__ API

Signed-off-by: David Aguilar <davvid@gmail.com>
Support collections.defaultdict

jsonpickle now recognizes the collections protocol for defaultdicts.
When the object contains a 'default_factory' attribute we pass it to
the the constructor when present.

'default_factory' must be a type with an argument-less constructor.

Signed-off-by: David Aguilar <davvid@gmail.com>
Support collections.deque

Support deque objects by introducing a new check for
"list-like objects" which are basically objects that implement
can be iterated and updated like a list.

Signed-off-by: David Aguilar <davvid@gmail.com>
Support collections.namedtuple

We can now serialize named tuples whose class definitions live
at the module scope.  We cannot (obviously) do anonymous namedtuples,
but supporting recommended best-practices for namedtuples covers
the common case.

We detect namedtuples by checking the class object for a "_fields"
member and compare its length to the {"py/seq": [...]}
inner list length.  When these are equal then we pass a restored
version of the inner list to the default constructor.

Signed-off-by: David Aguilar <davvid@gmail.com>
trivial: Remove an unused import and add a little whitespace

Signed-off-by: David Aguilar <davvid@gmail.com>
jsonpickle_test.py: Rename functions to avoid name conflicts

We were masking the name of an earlier function.  Rename it.

Signed-off-by: David Aguilar <davvid@gmail.com>
unpickler: Properly handle datetime objects inside dicts

Register datetime (and other "repr" objects) when creating them
so that they can be properly referenced.

Add a test case to cover this usage.

Closes #22

Reported-by: Denis Orlikhin <qbikk@ya.ru>
Signed-off-by: David Aguilar <davvid@gmail.com>
[update] chaining statements to become python 3 compatible
[update] removed unnecessary list() wrapper in some collections.
[config] travis configuration
[config] project configuration to run tests using nose and test with distinct python environments.
[update] more exception handling compatible with Python 3
[update] using six library to port the lib to python 3.
docs: jsonpickle supports namedtuples

Closes #34

Signed-off-by: David Aguilar <davvid@gmail.com>
Merge pull request #35 from davvid/collections

Collections
Merge pull request #17 from davvid/docs

Document the __getstate__ and __setstate__ API
Merge branch 'repr-enhancements'

* repr-enhancements:
  unpickler: Properly handle datetime objects inside dicts
  jsonpickle_test.py: Rename functions to avoid name conflicts
  trivial: Remove an unused import and add a little whitespace

Conflicts:
	jsonpickle/unpickler.py
	tests/jsonpickle_test.py

Signed-off-by: David Aguilar <davvid@gmail.com>
changelog: mention the datetime fixes

Signed-off-by: David Aguilar <davvid@gmail.com>
Merge pull request #36 from davvid/master

Datetime fixes part 1
__init__.py: version bump!

Signed-off-by: David Aguilar <davvid@gmail.com>