mailPickling problems with the relax data storage singleton.


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on November 20, 2007 - 19:01:
Chris and Gary,

Remember a long way back we had discussions about the following concept:

-----
class Data(dict):
    """The relax data storage object."""

[snip]

# Rebind the name Data with an instance to prevent accidental creation
# of multiple instances of the Data class
Data = Data()
-----

This was the method we decided upon for creating the data storage
singleton.  For the discussions about this design pattern see:

Parent thread:
https://mail.gna.org/public/relax-devel/2007-03/msg00012.html
(Message-id: <7f080ed10703070006s309a1e1do38e621f48d8f6d9e@xxxxxxxxxxxxxx>).

Second minor thread:
https://mail.gna.org/public/relax-devel/2007-03/msg00038.html
(Message-id: <7f080ed10703130151u6702d44ap7e75240e70893492@xxxxxxxxxxxxxx>).

The vote thread:
https://mail.gna.org/public/relax-devel/2007-03/msg00046.html
(Message-id: <7f080ed10703140609p70d35295ye10ee5939da494a2@xxxxxxxxxxxxxx>).


There is an issue with this approach that has been uncovered through
unit tests.  I have created a single unit test in the 1.3 line for the
saving of the relax state (which is really the pickling of the
singleton) which fails.  We need to work out how to fix the pickling
problem.  I have temporarily renamed the Data class to Data2, but this
means that we no longer have a singleton (see
https://mail.gna.org/public/relax-commits/2007-11/msg00328.html).
Would you be able to have a look at the unit test and this problem?  I
can't find any solutions in the pickling documentation.

Thanks,

Edward


P.S.  I will also implement a unit test or two for
generic_fns.state.load() to have a more comprehensive set of tests,
both for pickling and unpickling, for checking any code changes.



Related Messages


Powered by MHonArc, Updated Fri Nov 30 11:41:54 2007