[Zope3-checkins] CVS: Zope3/src/zope/app/fssync -
committer.py:1.18.2.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:07 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/fssync
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/fssync
Modified Files:
Tag: parentgeddon-branch
committer.py
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing. Specific log entries will be provided
when we merge this into the head.
=== Zope3/src/zope/app/fssync/committer.py 1.18 => 1.18.2.1 ===
--- Zope3/src/zope/app/fssync/committer.py:1.18 Fri Sep 5 14:41:16 2003
+++ Zope3/src/zope/app/fssync/committer.py Mon Sep 8 14:21:37 2003
@@ -28,13 +28,13 @@
from zope.app.interfaces.fssync import IObjectDirectory, IObjectFile
-from zope.app.context import ContextWrapper
-from zope.app.interfaces.container import IContainer, IZopeContainer
+from zope.app.interfaces.container import IContainer, IRemoveSource, IAddTarget
from zope.app.traversing import traverseName, getName
from zope.app.interfaces.file import IFileFactory, IDirectoryFactory
from zope.app.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.app.event.objectevent import ObjectModifiedEvent
+from zope.app.container.contained import contained
class SynchronizationError(Exception):
pass
@@ -344,7 +344,7 @@
# A given factory overrides everything
factory = resolve(factory_name)
obj = factory()
- obj = ContextWrapper(obj, container, name=name)
+ obj = contained(obj, container, name=name)
adapter = get_adapter(obj)
if IObjectFile.isImplementedBy(adapter):
data = read_file(fspath)
@@ -392,10 +392,11 @@
if IContainer.isImplementedBy(container):
if not replace:
publish(container, ObjectCreatedEvent(obj))
- container = getAdapter(container, IZopeContainer)
if replace:
- del container[name]
- newname = container.setObject(name, obj)
+ remover = zapi.getAdapter(container, IRemoveSource)
+ remover.removeObject(name)
+ adder = getAdapter(container, IAddTarget)
+ newname = adder.addObject(name, obj)
if newname != name:
raise SynchronizationError(
"Container generated new name for %s (new name %s)" %
@@ -408,8 +409,10 @@
def delete_item(container, name):
"""Helper to delete an item from a container or mapping."""
if IContainer.isImplementedBy(container):
- container = getAdapter(container, IZopeContainer)
- del container[name]
+ remover = zapi.getAdapter(container, IRemoveSource)
+ remover.removeObject(name)
+ else:
+ del container[name]
def load_file(fspath):
"""Helper to load an xml pickle from a file."""
More information about the Zope3-Checkins
mailing list