Commit 675b882b authored by Christophe Dumez's avatar Christophe Dumez

- don't use strings for some exceptions anymore (reported by Jerome)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6879 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3dbc585
...@@ -53,6 +53,16 @@ except ImportError: ...@@ -53,6 +53,16 @@ except ImportError:
class Error(exceptions.EnvironmentError): class Error(exceptions.EnvironmentError):
pass pass
class SubversionPreferencesError(Exception):
"""The base exception class for the Subversion preferences.
"""
pass
class SubversionUnknownBusinessTemplateError(Exception):
"""The base exception class when business template is unknown.
"""
pass
def removeAll(entry): def removeAll(entry):
''' '''
Remove all files and directories under 'entry'. Remove all files and directories under 'entry'.
...@@ -603,10 +613,10 @@ class SubversionTool(UniqueObject, Folder): ...@@ -603,10 +613,10 @@ class SubversionTool(UniqueObject, Folder):
if not wc_list: if not wc_list:
wc_list = self.getPortalObject().portal_preferences.default_site_preference.getPreferredSubversionWorkingCopyList() wc_list = self.getPortalObject().portal_preferences.default_site_preference.getPreferredSubversionWorkingCopyList()
if not wc_list: if not wc_list:
raise 'Preferences Error', 'Please set at least one Subversion Working Copy in preferences first.' raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.'
bt_name = bt.getTitle() bt_name = bt.getTitle()
if len(wc_list) == 0 : if len(wc_list) == 0 :
raise 'Preferences Error', 'Please set at least one Subversion Working Copy in preferences first.' raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.'
for wc in wc_list: for wc in wc_list:
if bt_name in os.listdir(wc) : if bt_name in os.listdir(wc) :
wc_path = os.path.join(wc, bt_name) wc_path = os.path.join(wc, bt_name)
...@@ -615,7 +625,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -615,7 +625,7 @@ class SubversionTool(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])
raise 'Unknown Business Template', "Could not find '"+bt_name+"' at first level of working copies." raise SubversionUnknownBusinessTemplateError, "Could not find '"+bt_name+"' at first level of working copies."
security.declareProtected('Import/Export objects', 'update') security.declareProtected('Import/Export objects', 'update')
def update(self, path): def update(self, 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