Commit 1cb15442 authored by Jérome Perrin's avatar Jérome Perrin

*: adjust what 2to3's raise fixer could not handle automatically

RefactoringTool: Warnings/messages while refactoring:
RefactoringTool: ### In file bt5/erp5_accounting_l10n_in/SkinTemplateItem/portal_skins/erp5_accounting_l10n_in/AccountModule_getTrialBalanceReportSectionList.py ###
RefactoringTool: Line 21: could not convert: raise 'Tree mode no longer supported'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/CategoryTool_generateTranslationFile.py ###
RefactoringTool: Line 27: could not convert: raise 'Redirect', '%s/view?portal_status_message=%s' % (
                         context.portal_categories.absolute_url(),
                         message)
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_exportTaskReportListAsiCalendar.py ###
RefactoringTool: Line 7: could not convert: raise 'Unauthorized', context
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file bt5/erp5_tiosafe_core/SkinTemplateItem/portal_skins/erp5_integration/IntegrationCategoryMapping_init.py ###
RefactoringTool: Line 1: could not convert: raise "yo", context
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file product/ERP5Configurator/Document/WorkflowSecurityConfiguratorItem.py ###
RefactoringTool: Line 69: could not convert: raise "NoValidName"
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file product/ERP5TioSafe/Conduit/AccountingERP5IntegrationConduit.py ###
RefactoringTool: Line 81: could not convert: raise "getObjectType: ERROR journal code unknow"
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: ### In file product/ERP5TioSafe/tests/testSaleOrderERP5Synchronization.py ###
RefactoringTool: Line 275: could not convert: raise 'A line has not been checked'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: Line 376: could not convert: raise 'A line has not been checked'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: Line 530: could not convert: raise 'A line has not been checked'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: Line 813: could not convert: raise 'A line has not been checked'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: Line 915: could not convert: raise 'A line has not been checked'
RefactoringTool: Python 3 does not support string exceptions
RefactoringTool: Line 962: could not convert: raise 'The lines must contain VAT, Product or Delivery, nothing else.'
RefactoringTool: Python 3 does not support string exceptions
parent 1c60256f
...@@ -18,7 +18,7 @@ show_parent_accounts = request.get('show_parent_accounts', False) ...@@ -18,7 +18,7 @@ show_parent_accounts = request.get('show_parent_accounts', False)
# flat_mode is a boolean that indicate wether we should use a report tree # flat_mode is a boolean that indicate wether we should use a report tree
# or a flat list of all accounts. # or a flat list of all accounts.
if request.get('tree_mode', False): if request.get('tree_mode', False):
raise 'Tree mode no longer supported' raise ValueError('Tree mode no longer supported')
result = [] result = []
params = { params = {
......
"""Return a po file from a spreadsheet of categories.""" """Return a po file from a spreadsheet of categories."""
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from zExceptions import Redirect
# Initialise some general variables # Initialise some general variables
detailed_report_result = [] detailed_report_result = []
...@@ -24,9 +25,9 @@ def invalid_category_spreadsheet_handler(message): ...@@ -24,9 +25,9 @@ def invalid_category_spreadsheet_handler(message):
# action taken when an invalid spreadsheet is provided. # action taken when an invalid spreadsheet is provided.
# we *raise* a Redirect, because we don't want the transaction to succeed # we *raise* a Redirect, because we don't want the transaction to succeed
# note, we could make a dialog parameter to allow import invalid spreadsheet: # note, we could make a dialog parameter to allow import invalid spreadsheet:
raise 'Redirect', '%s/view?portal_status_message=%s' % ( raise Redirect('%s/view?portal_status_message=%s' % (
context.portal_categories.absolute_url(), context.portal_categories.absolute_url(),
message) message))
category_list_mapping = context.Base_getCategoriesSpreadSheetMapping(import_file, category_list_mapping = context.Base_getCategoriesSpreadSheetMapping(import_file,
invalid_spreadsheet_error_handler=invalid_category_spreadsheet_handler) invalid_spreadsheet_error_handler=invalid_category_spreadsheet_handler)
......
"""Export the current selection in task report module in iCalendar format. """Export the current selection in task report module in iCalendar format.
""" """
from zExceptions import Unauthorized
# XXX bypass CookieCrumbler # XXX bypass CookieCrumbler
if context.REQUEST.AUTHENTICATED_USER.getUserName() == 'Anonymous User': if context.REQUEST.AUTHENTICATED_USER.getUserName() == 'Anonymous User':
if context.REQUEST.get('disable_cookie_login__', 0) \ if context.REQUEST.get('disable_cookie_login__', 0) \
or context.REQUEST.get('no_infinite_loop', 0) : or context.REQUEST.get('no_infinite_loop', 0) :
raise 'Unauthorized', context raise Unauthorized(context)
return context.REQUEST.RESPONSE.redirect(script.id + "?disable_cookie_login__=1&no_infinite_loop=1") return context.REQUEST.RESPONSE.redirect(script.id + "?disable_cookie_login__=1&no_infinite_loop=1")
def formatDate(date): def formatDate(date):
......
...@@ -66,7 +66,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -66,7 +66,7 @@ class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject):
if self.filename[-suffix_len:] == suffix: if self.filename[-suffix_len:] == suffix:
workflow_id = self.filename[:-suffix_len] workflow_id = self.filename[:-suffix_len]
else: else:
raise "NoValidName" raise ValueError("NoValidName")
# Configure state permission # Configure state permission
view_permission_list = ['View'] view_permission_list = ['View']
......
...@@ -78,7 +78,7 @@ class AccountingERP5IntegrationConduit(TioSafeBaseConduit): ...@@ -78,7 +78,7 @@ class AccountingERP5IntegrationConduit(TioSafeBaseConduit):
'PP', 'SA', 'SR', 'VP', 'VR'): 'PP', 'SA', 'SR', 'VP', 'VR'):
return 'Payment Transaction' return 'Payment Transaction'
else: else:
raise "getObjectType: ERROR journal code unknow" raise ValueError("getObjectType: ERROR journal code unknow")
return return
def constructContent(self, object, object_id, portal_type): def constructContent(self, object, object_id, portal_type):
......
...@@ -272,7 +272,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -272,7 +272,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
self.assertEqual(round(line.getPrice(), 6), 6.672241) self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency) self.assertEqual(line.getPriceCurrencyValue(), currency)
else: else:
raise 'A line has not been checked' self.fail('A line has not been checked')
# Check the XML schema and the fixed point # Check the XML schema and the fixed point
self.checkTioSafeXML( self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()),
...@@ -373,7 +373,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -373,7 +373,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
self.assertEqual(round(line.getPrice(), 6), 6.672241) self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency) self.assertEqual(line.getPriceCurrencyValue(), currency)
else: else:
raise 'A line has not been checked' self.fail('A line has not been checked')
# Check the XML schema and the fixed point # Check the XML schema and the fixed point
self.checkTioSafeXML( self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()),
...@@ -527,7 +527,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -527,7 +527,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
self.assertEqual(round(line.getPrice(), 6), 6.672241) self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency) self.assertEqual(line.getPriceCurrencyValue(), currency)
else: else:
raise 'A line has not been checked' self.fail('A line has not been checked')
# Check the XML schema and the fixed point # Check the XML schema and the fixed point
self.checkTioSafeXML( self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()),
...@@ -810,7 +810,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -810,7 +810,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
self.assertEqual(round(line.getPrice(), 6), 6.672241) self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency) self.assertEqual(line.getPriceCurrencyValue(), currency)
else: else:
raise 'A line has not been checked' self.fail('A line has not been checked')
# Check the XML schema and the fixed point # Check the XML schema and the fixed point
self.checkTioSafeXML( self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()),
...@@ -912,7 +912,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -912,7 +912,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
else: else:
self.assertTrue(line.getTitle() in ['Delivery', 'Stylo']) self.assertTrue(line.getTitle() in ['Delivery', 'Stylo'])
raise 'A line has not been checked' self.fail('A line has not been checked')
# Check the accounting # Check the accounting
sale_packing_list = sale_order.getCausalityRelatedValue( sale_packing_list = sale_order.getCausalityRelatedValue(
portal_type='Sale Packing List', portal_type='Sale Packing List',
...@@ -959,7 +959,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): ...@@ -959,7 +959,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin):
self.assertEqual(line.getPrice(), 0.0) self.assertEqual(line.getPrice(), 0.0)
self.assertEqual(line.getTotalPrice(), 0.0) self.assertEqual(line.getTotalPrice(), 0.0)
else: else:
raise 'The lines must contain VAT, Product or Delivery, nothing else.' self.fail('The lines must contain VAT, Product or Delivery, nothing else.')
# Check the XML schema and the fixed point # Check the XML schema and the fixed point
self.checkTioSafeXML( self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()),
......
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