Commit a8b3e81a authored by Nicolas Dumazet's avatar Nicolas Dumazet

deprecate *_files, use *_file_list instead


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31610 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84d0b47c
...@@ -56,6 +56,7 @@ except ImportError: ...@@ -56,6 +56,7 @@ except ImportError:
pysvn = None pysvn = None
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from warnings import warn
NBSP = ' ' NBSP = ' '
NBSP_TAB = NBSP*8 NBSP_TAB = NBSP*8
...@@ -873,29 +874,41 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -873,29 +874,41 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
security.declareProtected('Import/Export objects', 'revertZODB') security.declareProtected('Import/Export objects', 'revertZODB')
# path can be absolute or relative # path can be absolute or relative
def revertZODB(self, business_template, added_files=None, \ def revertZODB(self,
other_files=None, recurse=False): business_template,
added_file_list=None,
other_file_list=None,
recurse=False,
# deprecated:
added_files=None,
other_files=None,
):
"""Revert local changes in a file or a directory """Revert local changes in a file or a directory
in ZODB and on hard drive in ZODB and on hard drive
XXX-JPS: naming of parameters is wrong. added_files
should be added_file_list. Action: rename to added_file_list
and provide compatibility for scripts.
""" """
if added_files is not None:
warn('Parameter added_files is deprecated, used added_file_list ' \
'instead.', DeprecationWarning)
added_file_list = added_files
if other_files is not None:
warn('Parameter other_files is deprecated, used other_file_list ' \
'instead.', DeprecationWarning)
other_file_list = other_files
client = self._getClient() client = self._getClient()
object_to_update = {} object_to_update = {}
# Transform params to list if they are not already lists # Transform params to list if they are not already lists
if not added_files : if not added_file_list:
added_files = [] added_file_list = []
if not other_files : if not other_file_list:
other_files = [] other_file_list = []
if not isinstance(added_files, list) : if not isinstance(added_file_list, list) :
added_files = [added_files] added_file_list = [added_file_list]
if not isinstance(other_files, list) : if not isinstance(other_file_list, list) :
other_files = [other_files] other_file_list = [other_file_list]
# Reinstall removed or modified files # Reinstall removed or modified files
for path in other_files : for path in other_file_list :
# security check # security check
self._getWorkingPath(self.relativeToAbsolute(path, business_template)) self._getWorkingPath(self.relativeToAbsolute(path, business_template))
path_list = path.split(os.sep) path_list = path.split(os.sep)
...@@ -907,7 +920,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -907,7 +920,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
object_to_update[tmp] = 'install' object_to_update[tmp] = 'install'
path_added_list = [] path_added_list = []
# remove added files # remove added files
for path in added_files : for path in added_file_list :
# security check # security check
self._getWorkingPath(self.relativeToAbsolute(path, business_template)) self._getWorkingPath(self.relativeToAbsolute(path, business_template))
path_list = path.split(os.sep) path_list = path.split(os.sep)
...@@ -932,9 +945,9 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -932,9 +945,9 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
# Remove it from portal template # Remove it from portal template
business_template.portal_templates.manage_delObjects(ids=tmp_bt.getId()) business_template.portal_templates.manage_delObjects(ids=tmp_bt.getId())
#revert changes #revert changes
added_files.extend(other_files) added_file_list.extend(other_file_list)
to_revert = [self.relativeToAbsolute(x, business_template) \ to_revert = [self.relativeToAbsolute(x, business_template) \
for x in added_files] for x in added_file_list]
if len(to_revert) != 0 : if len(to_revert) != 0 :
client.revert(to_revert, recurse) client.revert(to_revert, recurse)
# Partially reinstall installed bt # Partially reinstall installed bt
......
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