[Zope3-checkins] CVS: Zope3/utilities/fssync - update.py:1.5
Guido van Rossum
guido@python.org
Tue, 6 May 2003 14:10:37 -0400
Update of /cvs-repository/Zope3/utilities/fssync
In directory cvs.zope.org:/tmp/cvs-serv12351
Modified Files:
update.py
Log Message:
Change the strategy in update(): if fspath is the toplevel directory
(i.e. there's no @@Zope directory in its parent), do an update for
each of its items (files and directories alike). The code to do this
was already there but relied on the SYNCROOT environment variable,
which doesn't always work.
=== Zope3/utilities/fssync/update.py 1.4 => 1.5 ===
--- Zope3/utilities/fssync/update.py:1.4 Mon May 5 17:51:00 2003
+++ Zope3/utilities/fssync/update.py Tue May 6 14:10:36 2003
@@ -20,8 +20,6 @@
from zope.app.fssync.syncer import toFS
-env = os.environ
-
def update(fspath, dbpath, siteconfpath):
"""Updates the checked out objects in the file system from a ZODB
@@ -29,19 +27,19 @@
by -f option.
"""
root = getApplicationRoot(dbpath, siteconfpath)
- if env.has_key('SYNCROOT'):
- if os.path.abspath(fspath) == os.path.abspath(env['SYNCROOT']):
- if os.path.isdir(os.path.abspath(fspath)):
- module_list = os.listdir(os.path.abspath(fspath))
- if '@@Zope' in module_list:
- module_list.remove('@@Zope')
- for module in module_list:
- fspath = os.path.join(fspath, module)
- updateSettings(fspath, root)
- else:
- return ('sync [update aborted] : '
- '@@Zope administrative folder not found in %s' %
- fspath)
+ if os.path.isdir(fspath):
+ fsparent = os.path.dirname(os.path.abspath(fspath))
+ if not os.path.exists(os.path.join(fsparent, '@@Zope')):
+ module_list = os.listdir(os.path.abspath(fspath))
+ if '@@Zope' in module_list:
+ module_list.remove('@@Zope')
+ for module in module_list:
+ fsp = os.path.join(fspath, module)
+ updateSettings(fsp, root)
+ else:
+ return ('sync [update aborted] : '
+ '@@Zope administrative folder not found in %s' %
+ fspath)
else:
updateSettings(fspath, root)
else: