Package twisted :: Package spread :: Module jelly :: Class _Jellier |
[show private | hide private]
[frames | no frames]

## Class _Jellier

(Internal) This class manages state for a call to jelly()

Method Summary
| ``__init__`(self, taster, persistentStore, invoker)` Initialize.
| `jelly(self, obj)`
| ``prepare`(self, object)` (internal) create a list for persisting an object to.
| ``preserve`(self, object, sexp)` (internal) mark an object's persistent list for later referral
| ``unpersistable`(self, reason, sxp)` (internal) Returns an sexp: (unpersistable "reason").
| `_checkMutable(self, obj)`
| ``_cook`(self, object)` (internal)

Class Variable Summary
`dict` | `constantTypes`

Method Details

### __init__(self, taster, persistentStore, invoker) (Constructor) Initialize.

### prepare(self, object) (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]].

### preserve(self, object, sexp) (internal) mark an object's persistent list for later referral

### unpersistable(self, reason, sxp=None) (internal) Returns an sexp: (unpersistable "reason"). Utility method for making note that a particular object could not be serialized.

### _cook(self, 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

Class Variable Details

    ### constantTypes Type: `dict` Value:
        {<type 'str'>: 1, <type 'int'>: 1, <type 'float'>: 1, <type 'long'>: 1\
        }

Generated by Epydoc 1.1 on Thu May 8 13:19:29 2003 | http://epydoc.sf.net