Commit a007d846 authored by Julien Muchembled's avatar Julien Muchembled

Fix [33931]

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33940 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 71075f67
No related merge requests found
import errno
import os import os
import shutil import shutil
import sys import sys
...@@ -20,11 +19,8 @@ save = int(os.environ.get('erp5_save_data_fs', 0)) ...@@ -20,11 +19,8 @@ save = int(os.environ.get('erp5_save_data_fs', 0))
_print("Cleaning static files ... ") _print("Cleaning static files ... ")
static_dir_list = 'Constraint', 'Document', 'PropertySheet', 'Extensions' static_dir_list = 'Constraint', 'Document', 'PropertySheet', 'Extensions'
for dir in static_dir_list: for dir in static_dir_list:
try: for f in glob.glob(os.path.join(instance_home, dir, '*')):
shutil.rmtree(os.path.join(instance_home, dir)) os.remove(f)
except OSError, e:
if e.errno != errno.ENOENT:
raise
if load: if load:
dump_sql = os.path.join(instance_home, 'dump.sql') dump_sql = os.path.join(instance_home, 'dump.sql')
...@@ -38,6 +34,7 @@ if load: ...@@ -38,6 +34,7 @@ if load:
for dir in static_dir_list: for dir in static_dir_list:
full_path = os.path.join(instance_home, dir) full_path = os.path.join(instance_home, dir)
if os.path.exists(full_path + '.bak'): if os.path.exists(full_path + '.bak'):
os.rmdir(full_path)
shutil.copytree(full_path + '.bak', full_path, symlinks=True) shutil.copytree(full_path + '.bak', full_path, symlinks=True)
elif save and os.path.exists(data_fs_path): elif save and os.path.exists(data_fs_path):
os.remove(data_fs_path) os.remove(data_fs_path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment