Part of twisted.spread.jelly View Source View In Hierarchy
|Method||prepare||(internal) Create a list for persisting an object to. This will allow backreferences to be made internal to the object. (circular references).|
|Method||preserve||(internal) Mark an object's persistent list for later referral.|
|Method||jelly_decimal||Jelly a decimal object.|
|Method||unpersistable||(internal) Returns an sexp: (unpersistable "reason"). Utility method for making note that a particular object could not be serialized.|
|Method||_cook||(internal) Backreference an object.|
|Method||_jellyIterable||Jelly an iterable object.|
(internal) Backreference an object.
Notes on this method for the hapless future maintainer: If I've already gone through the prepare/preserve cycle on the specified object (it is being referenced after the serializer is "done with" it, e.g. this reference is NOT circular), the copy-in-place of aList is relevant, since the list being modified is the actual, pre-existing jelly expression that was returned for that object. If not, it's technically superfluous, since the value in self.preserved didn't need to be set, but the invariant that self.preserved[id(object)] is a list is convenient because that means we don't have to test and create it or not create it here, creating fewer code-paths. that's why self.preserved is always set to a list.Sorry that this code is so hard to follow, but Python objects are tricky to persist correctly. -glyph
(internal) Create a list for persisting an object to. This will allow backreferences to be made internal to the object. (circular references).The reason this needs to happen is that we don't generate an ID for every object, so we won't necessarily know which ID the object will have in the future. When it is 'cooked' ( see _cook ), it will be assigned an ID, and the temporary placeholder list created here will be modified in-place to create an expression that gives this object an ID: [reference id# [object-jelly]].
|Parameters||atom||the identifier atom of the object.
|obj||any iterable object.
|Returns||a generator of jellied data.
|Parameters||d||a decimal object to serialize.
|Returns||jelly for the decimal object.