Factored out _get_flattener

--HG--
extra : rebase_source : f97be8ab2137de3216baa98d298a1cdea59ef128
Fixed typos in 'unpicklable' attribute
Use SimpleReduceHandler to support encoding and decoding of OrderedDict

--HG--
extra : rebase_source : f613e5e8c1ea0baf1d737353aec53349b8be1d4a
extra : histedit_source : 75a9f14fc4b6664c040eeb5311e18ee0786635a6%2C030200d658d07920863ff57423b354ab855ea981
Update SimpleReduceHandler.restore to better follow the protocol.
Fix error in test_handlers following merge of self-registering handlers
Rakefile: rename variable to avoid symbol redefinition warnings

The symbol in the eval()'d version.py file is also called VERSION,
so rename the file variable to VERSION_FILE to avoid redefining
VERSION when calling eval().

Signed-off-by: David Aguilar <davvid@gmail.com>
Merge pull request #44 from jaraco/fix-handler-tests

Fix error in test_handlers following merge of self-registering handlers
unpickler: fix doctest for _mkref()

Signed-off-by: David Aguilar <davvid@gmail.com>
Merge pull request #42 from jaraco/ordered-dict

Use SimpleReduceHandler to support encoding and decoding of OrderedDict
Merge pull request #40 from jaraco/extract-get-flattener

Factored out _get_flattener
doctest: fix tests when run under "nosetests --with-doctest"

nosetests cannot access the "samples" module so inline the Thing
class into the doctests so that they are self-contained.

Mention that objects must inherit from "object" (new-style classes).

Closes #38

Signed-off-by: David Aguilar <davvid@gmail.com>
unpickler: do not setattr() on tuples

Python 2.7 and newer does not allow doing setattr()
on instances of tuple().  We don't actually need to do it
since the namedtuple has already been completely decoded,
so returning early is desired.

This fixes the tests on Python 2.7.3.

Signed-off-by: David Aguilar <davvid@gmail.com>
tests: simplify tests by moving samples.py to jsonpickle._samples

jsonpickle requires that the objects it reconstitutes are available
globally via a module.

This makes some of the doctests difficult to write because samples.py
is not always available on the sys.path.

Simplify things by moving our samples objects to jsonpickle/_samples.py.
This removes some duplication from the doctests and ensures that
nosetests --with-doctest works correctly without needing to modify
the PYTHONPATH.

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