Module spiroserver :: Class SpiroUnpickler
[show private | hide private]
[frames | no frames]

Class SpiroUnpickler

Unpickler --+
            |
           SpiroUnpickler


A butchered unpickler which facilitates the passing of object refs between server and client.

It substitutes the locally cached objects in place of refs to these objects.

So we intercept the unpickling and, when client sends a req containing a SpiroObject instance, we look up our locally cached object and substitute that instaed.
Method Summary
  __init__(self, spirosession, pickled)
Altered front-end, because this unpickler needs to look up locally cached objects
  load_build(self)
Detect SpiroObject instance refs, and replace these with refs to the corresponding locally cached objects.
    Inherited from Unpickler
  find_class(self, module, name)
  get_extension(self, code)
  load(self)
Read a pickled object representation from the open file.
  load_append(self)
  load_appends(self)
  load_binfloat(self, unpack)
  load_binget(self)
  load_binint(self)
  load_binint1(self)
  load_binint2(self)
  load_binpersid(self)
  load_binput(self)
  load_binstring(self)
  load_binunicode(self)
  load_dict(self)
  load_dup(self)
  load_empty_dictionary(self)
  load_empty_list(self)
  load_empty_tuple(self)
  load_eof(self)
  load_ext1(self)
  load_ext2(self)
  load_ext4(self)
  load_false(self)
  load_float(self)
  load_get(self)
  load_global(self)
  load_inst(self)
  load_int(self)
  load_list(self)
  load_long(self)
  load_long1(self)
  load_long4(self)
  load_long_binget(self)
  load_long_binput(self)
  load_mark(self)
  load_newobj(self)
  load_none(self)
  load_obj(self)
  load_persid(self)
  load_pop(self)
  load_pop_mark(self)
  load_proto(self)
  load_put(self)
  load_reduce(self)
  load_setitem(self)
  load_setitems(self)
  load_short_binstring(self)
  load_stop(self)
  load_string(self)
  load_true(self)
  load_tuple(self)
  load_tuple1(self)
  load_tuple2(self)
  load_tuple3(self)
  load_unicode(self)
  marker(self)

Class Variable Summary
    Inherited from Unpickler
dict dispatch = {'': <function load_eof at 0x40276144>, '\x80...

Method Details

__init__(self, spirosession, pickled)
(Constructor)

Altered front-end, because this unpickler needs to look up locally cached objects

Arguments:
  • spirosession - a SpiroSession object
  • pickled - a string which was picked on the client side
Overrides:
pickle.Unpickler.__init__

load_build(self)

Detect SpiroObject instance refs, and replace these with refs to the corresponding locally cached objects.

During unpickling, load_build gets called just as an object is reconstituted and its state restored, so this is the perfect time to remove SpiroObject refs from the stack and replace them with the real local objects
Overrides:
pickle.Unpickler.load_build

Generated by Epydoc 2.0 on Sun Apr 11 13:37:10 2004 http://epydoc.sf.net