[Zope3-checkins] CVS: Zope3/src/zope/app/fssync - committer.py:1.13
Guido van Rossum
guido@python.org
Tue, 10 Jun 2003 18:02:37 -0400
Update of /cvs-repository/Zope3/src/zope/app/fssync
In directory cvs.zope.org:/tmp/cvs-serv22354
Modified Files:
committer.py
Log Message:
Add an optional flag argument raise_on_conflicts to the Checker class;
if this is set, conflicts raise SynchronizationError immediately.
This is a debugging aid.
=== Zope3/src/zope/app/fssync/committer.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/fssync/committer.py:1.12 Mon Jun 9 14:48:52 2003
+++ Zope3/src/zope/app/fssync/committer.py Tue Jun 10 18:02:36 2003
@@ -30,6 +30,7 @@
from zope.app.interfaces.fssync \
import IObjectEntry, IObjectDirectory, IObjectFile
+from zope.app.context import ContextWrapper
from zope.app.interfaces.container import IContainer, IZopeContainer
from zope.app.fssync.classes import Default
from zope.app.traversing import getPath, traverseName, objectName
@@ -47,11 +48,12 @@
The public API consists of __init__(), check() and errors() only.
"""
- def __init__(self, metadata=None):
+ def __init__(self, metadata=None, raise_on_conflicts=False):
"""Constructor. Optionally pass a metadata database."""
if metadata is None:
metadata = Metadata()
self.metadata = metadata
+ self.raise_on_conflicts = raise_on_conflicts
self.conflicts = []
def errors(self):
@@ -183,6 +185,8 @@
Conflicts can be retrieved by calling errors().
"""
+ if self.raise_on_conflicts:
+ raise SynchronizationError(fspath)
if fspath not in self.conflicts:
self.conflicts.append(fspath)
@@ -322,6 +326,7 @@
# A given factory overrides everything
factory = resolve(factory_name)
obj = factory()
+ obj = ContextWrapper(obj, container, name=name)
adapter = get_adapter(obj)
if IObjectFile.isImplementedBy(adapter):
data = read_file(fspath)