Commit deb4117f authored by Vincent Pelletier's avatar Vincent Pelletier

Remove duplicated error handling code.

Make error message clearer when a business template is not found in the list of working copies.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9804 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c43e4ec2
...@@ -706,10 +706,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -706,10 +706,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
if not wc_list: if not wc_list:
wc_list = self.getPortalObject().portal_preferences.\ wc_list = self.getPortalObject().portal_preferences.\
default_site_preference.getPreferredSubversionWorkingCopyList() default_site_preference.getPreferredSubversionWorkingCopyList()
if not wc_list: if not wc_list or len(wc_list) == 0 :
raise SubversionPreferencesError, \
'Please set at least one Subversion Working Copy in preferences first.'
if len(wc_list) == 0 :
raise SubversionPreferencesError, \ raise SubversionPreferencesError, \
'Please set at least one Subversion Working Copy in preferences first.' 'Please set at least one Subversion Working Copy in preferences first.'
bt_name = business_template.getTitle() bt_name = business_template.getTitle()
...@@ -722,13 +719,8 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -722,13 +719,8 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
return wc_path return wc_path
else: else:
return os.sep.join(wc_path.split(os.sep)[:-1]) return os.sep.join(wc_path.split(os.sep)[:-1])
if os.path.isdir(os.path.join(working_copy, '.svn')): raise SubversionUnknownBusinessTemplateError,
raise SubversionUnknownBusinessTemplateError, "Could not find '"+\ "Could not find '%s' at first level of working copies." % (bt_name, )
bt_name+"' at first level of working copies."
else:
raise SubversionNotAWorkingCopyError, \
"You must do a clean checkout first. It seems that at least one \
of the paths given in preferences is not a SVN working copy"
def _getWorkingPath(self, path): def _getWorkingPath(self, path):
""" Check if the given path is reachable (allowed) """ Check if the given path is reachable (allowed)
......
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