OK, sorry. The hook is elsewhere:

You should provide a __setstate__ method on Tableau (or if you don't
like that, a proxy class that you provide with
register_unpickle_override). Now you have to write __setstate__ in
such a way that it can distinguish between input data for either
Tableau_class or for Tableau and take appropriate action in either
case.

The default unpickling seems to be:
 - make a new class instance (but don't run __init__)
 - set the instance attribute dictionary to a value obtained from the
pickle.

so if you changed the layout of the attributes that won't work.

When you supply a __setstate__ method you get to decide yourself what
goes into the dictionary (or whatever other actions you want to take).
It should probably look something like:

  def __setstate__(self,a):
      if <a is a dictionary for Tableau_class>:
          self.new_attribute=a['old_attribute']
          ... and other conversions ...
      else:
          self.__dict__.update(a)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to