[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/schemagen - schemaspec.py:1.3
Martijn Faassen
m.faassen@vet.uu.nl
Thu, 12 Dec 2002 13:54:20 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/schemagen
In directory cvs.zope.org:/tmp/cvs-serv20820
Modified Files:
schemaspec.py
Log Message:
Added test that exercises generated __setstate__ in simple way; still
need more extensive tests. Fixed various bugs along the way. Also
implemented a test for prepareSetstate().
=== Zope3/lib/python/Zope/App/schemagen/schemaspec.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/schemagen/schemaspec.py:1.2 Thu Dec 12 13:28:03 2002
+++ Zope3/lib/python/Zope/App/schemagen/schemaspec.py Thu Dec 12 13:54:20 2002
@@ -120,7 +120,8 @@
'transformations = %s.prepareSetstate(self, state, %r)' % (
_helper_module, self._current_version),
'if transformations is None:',
- ' return'
+ ' return',
+ 'dict = self.__dict__'
]
count = self._current_version - len(self._history)
for item in self._history:
@@ -227,10 +228,11 @@
def prepareSetstate(obj, state, schema_version):
obj.__dict__.update(state)
state_version = state['__schema_version__']
- if current_version == state_version:
+ if schema_version == state_version:
return None
- assert state_version < current_version
- self.__schema_version__ = schema_version
- for i in range(state_version, current_version):
+ assert state_version < schema_version
+ obj.__schema_version__ = schema_version
+ d = {}
+ for i in range(state_version, schema_version):
d[i] = 1
return d