Ok now I think I understand the following:
2009/10/24 David Aguilar <dav[..]@
gmail.com>
> The referencing code needs a rework too. We want to be able to
> reconstruct refs into array elements, and presumably it'd be
> better if we were able to do so for any arbitrary objects as
> keys, not just dicts, but dicts are a good starting point.
[snip]
>
> Once it's well tested then the
> work of getting it to support refs like the following would be
> something to think about:
>
> class A(object):
> pass
>
> a = A()
> a.items = [A(), A(), A()]
> a.first = a.items[0]
> a.stuff = {a.first: a.first}
> a.morestuff = {a.stuff: a.stuff}
>
> pickle = jsonpickle.encode(a)
> b = jsonpickle.decode(pickle)
>
> item = b.items[0]
> self.assertEqual(b.first, item)
> self.assertEqual(b.stuff[b.first], item)
> self.assertEqual(b.morestuff[b.stuff][b.first], item)
I've created a branch which adds the above tests for complex
referencing:
http://github.com/eoghanmurray/jsonpickle/tree/refs
I'm awaiting an answer to the following:
http://code.google.com/p/jsonpath/issues/detail?id=14
(which would address test_refs_keys_values)
to see if jsonpath is a good candidate to solve all the referencing
problems.
E