[Zope3-checkins] CVS: Zope3/src/zope/fssync - snarf.py:1.4

Fred L. Drake, Jr. fred@zope.com
Tue, 8 Jul 2003 12:01:04 -0400


Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv1362

Modified Files:
	snarf.py 
Log Message:
add a few assertions to make sure we don't violate our input
requirements


=== Zope3/src/zope/fssync/snarf.py 1.3 => 1.4 ===
--- Zope3/src/zope/fssync/snarf.py:1.3	Tue May 27 10:45:36 2003
+++ Zope3/src/zope/fssync/snarf.py	Tue Jul  8 12:00:56 2003
@@ -53,6 +53,9 @@
         prefix -- optional snarf path prefix, either empty or ending in '/'.
         filter -- optional filter predicate.
         """
+        if prefix:
+            assert prefix[0] != "/"
+            assert prefix[-1] == "/"
         if filter is None:
             def filter(fspath):
                 return True
@@ -69,6 +72,7 @@
 
     def addfile(self, fspath, path):
         """Snarf a single file given by fspath."""
+        assert path[-1] != "/"
         f = open(fspath, "rb")
         try:
             f.seek(0, 2)