(Internal) This class manages state for a call to jelly()
Methods
|
|
__init__
_cook
jelly
prepare
preserve
unpersistable
|
|
__init__
|
__init__ (
self,
taster,
persistentStore,
invoker,
)
Initialize.
|
|
_cook
|
_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
|
|
jelly
|
jelly ( self, obj )
Exceptions
|
|
InsecureJelly("Type not allowed for object: %s %s" %( objType, obj ) )
NotImplementedError( "Don't know the type: %s" % objType )
|
|
|
prepare
|
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
|
preserve (
self,
object,
sexp,
)
(internal)
mark an object's persistent list for later referral
|
|
unpersistable
|
unpersistable (
self,
reason,
sxp=None,
)
(internal)
Returns an sexp: (unpersistable "reason"). Utility method for making
note that a particular object could not be serialized.
|
|