[Zope3-checkins] CVS: Zope3/src/zope/app/browser/content -
fssync.py:1.26
Fred L. Drake, Jr.
fred at zope.com
Tue Jan 13 17:29:17 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/content
In directory cvs.zope.org:/tmp/cvs-serv16405/src/zope/app/browser/content
Modified Files:
fssync.py
Log Message:
- move the fssync "Syner" and serialization adapter interfaces into
the zope.fssync.server package
- remove annotations() from IObjectEntry, implementations
(should be near-free since these should not used anymore)
- make the syncer, checker, committer parameterizable with three
functions that operate on content objects:
- get the serialization adapter
- get the annotations adapter
- get the object identifier
=== Zope3/src/zope/app/browser/content/fssync.py 1.25 => 1.26 ===
--- Zope3/src/zope/app/browser/content/fssync.py:1.25 Sun Sep 21 13:30:22 2003
+++ Zope3/src/zope/app/browser/content/fssync.py Tue Jan 13 17:28:46 2004
@@ -25,7 +25,7 @@
from zope.app.publisher.browser import BrowserView
from zope.app.traversing import getName, getParent, getRoot
from zope.fssync.snarf import Snarfer, Unsnarfer
-from zope.app.fssync.syncer import toFS
+from zope.app.fssync import syncer
from zope.app.fssync.committer import Committer, Checker
from zope.fssync.metadata import Metadata
@@ -50,7 +50,9 @@
dirname = tempfile.mktemp()
try:
os.mkdir(dirname)
- toFS(self.context, getName(self.context) or "root", dirname)
+ syncer.toFS(self.context,
+ getName(self.context) or "root",
+ dirname)
return snarf_dir(self.request.response, dirname)
finally:
if os.path.isdir(dirname):
@@ -129,7 +131,8 @@
uns.unsnarf(self.tempdir)
def call_committer(self):
- c = Committer(self.metadata)
+ c = Committer(syncer.getSerializer, self.metadata,
+ getAnnotations=syncer.getAnnotations)
c.synch(self.container, self.name, self.fspath)
@@ -193,11 +196,17 @@
def make_metadata(self):
self.metadata = Metadata()
+ def get_checker(self, raise_on_conflicts=False):
+ return Checker(syncer.getSerializer,
+ self.metadata,
+ raise_on_conflicts,
+ getAnnotations=syncer.getAnnotations)
+
def call_checker(self):
if self.get_arg("raise"):
- c = Checker(self.metadata, True)
+ c = self.get_checker(True)
else:
- c = Checker(self.metadata)
+ c = self.get_checker()
c.check(self.container, self.name, self.fspath)
self.errors = c.errors()
@@ -214,7 +223,9 @@
def write_to_filesystem(self):
shutil.rmtree(self.tempdir) # Start with clean slate
os.mkdir(self.tempdir)
- toFS(self.context, getName(self.context) or "root", self.tempdir)
+ syncer.toFS(self.context,
+ getName(self.context) or "root",
+ self.tempdir)
def send_archive(self):
return snarf_dir(self.request.response, self.tempdir)
More information about the Zope3-Checkins
mailing list