[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/FSSync - Syncer.py:1.3
Jim Fulton
jim@zope.com
Tue, 15 Oct 2002 09:21:46 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/FSSync
In directory cvs.zope.org:/tmp/cvs-serv6949
Modified Files:
Syncer.py
Log Message:
Fixed handling of special case of serialized strings. Strings being
read from the file-system were not handled correctly.
=== Zope3/lib/python/Zope/App/FSSync/Syncer.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/FSSync/Syncer.py:1.2 Fri Oct 11 02:28:05 2002
+++ Zope3/lib/python/Zope/App/FSSync/Syncer.py Tue Oct 15 09:21:45 2002
@@ -173,19 +173,23 @@
_setItem(container, name, newOb, old=1)
elif not factory:
- # Special case pickle data
- oldOb = container[name]
- newOb = loads(open(path).read())
- try:
- # See id we can amd should just copy the state
- oldOb._p_oid # Is it persisteny
- getstate = newOb.__getstate__
- except AttributeError:
- # Nope, we have to replace.
+ if entry.get('type') == '__builtin__.str':
+ newOb = open(path).read()
_setItem(container, name, newOb, old=1)
else:
- oldOb.__setstate__(getstate())
- oldOb._p_changed = 1
+ # Special case pickle data
+ oldOb = container[name]
+ newOb = loads(open(path).read())
+ try:
+ # See if we can and should just copy the state
+ oldOb._p_oid # Is it persisteny
+ getstate = newOb.__getstate__
+ except AttributeError:
+ # Nope, we have to replace.
+ _setItem(container, name, newOb, old=1)
+ else:
+ oldOb.__setstate__(getstate())
+ oldOb._p_changed = 1
else: