Commit e5fd9154 authored by Jérome Perrin's avatar Jérome Perrin

py3: 2to3 -j 20 --write --nobackups --no-diffs --fix=raise master

parent 407f2bea
......@@ -76,7 +76,7 @@ if open_sale_order_count == 0:
elif open_sale_order_count == 1:
open_sale_order = open_sale_order_list[0].getObject()
else:
raise ValueError, "Too many open order '%s' found: %s" % (person.getRelativeUrl(), [x.path for x in open_sale_order_list])
raise ValueError("Too many open order '%s' found: %s" % (person.getRelativeUrl(), [x.path for x in open_sale_order_list]))
delete_line_list = []
add_line_list = []
......
......@@ -4,7 +4,7 @@ the new Invoice.
from Products.ERP5Type.Message import translateString
from DateTime import DateTime
if related_simulation_movement_path_list is None:
raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.'
raise RuntimeError('related_simulation_movement_path_list is missing. Update ERP5 Product.')
invoice = context
price_currency = invoice.getPriceCurrency()
......
if related_simulation_movement_path_list is None:
raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.'
raise RuntimeError('related_simulation_movement_path_list is missing. Update ERP5 Product.')
packing_list = context
......
......@@ -48,7 +48,7 @@ class SlapOSCatalogToolCacheMixin(object):
validation_state="validated",
reference=reference)
if len(compute_node_list) != 1:
raise NotFound, "No document found with parameters: %s" % reference
raise NotFound("No document found with parameters: %s" % reference)
else:
return _assertACI(compute_node_list[0].getObject()).getRelativeUrl()
......@@ -88,7 +88,7 @@ class SlapOSCatalogToolCacheMixin(object):
parent_uid=self._getNonCachedComputeNodeUid(
compute_node_reference))
if len(compute_partition_list) != 1:
raise NotFound, "No document found with parameters: %s %s" % \
(compute_node_reference, compute_partition_reference)
raise NotFound("No document found with parameters: %s %s" % \
(compute_node_reference, compute_partition_reference))
else:
return _assertACI(compute_partition_list[0].getObject())
......@@ -278,8 +278,8 @@ class SlapOSComputeNodeMixin(object):
software_instance = _assertACI(software_instance_list[0].getObject())
elif software_instance_count > 1:
# XXX do not prevent the system to work if one partition is broken
raise NotImplementedError, "Too many instances linked to %s" % \
compute_partition_document.getRelativeUrl()
raise NotImplementedError("Too many instances linked to %s" % \
compute_partition_document.getRelativeUrl())
if software_instance is not None:
state = software_instance.getSlapState()
......
......@@ -98,9 +98,9 @@ class SlapOSComputePartitionMixin(object):
software_instance = _assertACI(software_instance_list[0].getObject())
elif software_instance_count > 1:
# XXX do not prevent the system to work if one partition is broken
raise NotImplementedError, "Too many instances %s linked to %s" % \
raise NotImplementedError("Too many instances %s linked to %s" % \
([x.path for x in software_instance_list],
self.getRelativeUrl())
self.getRelativeUrl()))
if software_instance is not None:
state = software_instance.getSlapState()
......
......@@ -11,8 +11,8 @@ if (instance.getSlapState() != "destroy_requested"):
elif instance.getPortalType() == 'Slave Instance':
is_slave = True
else:
raise NotImplementedError, "Unknown portal type %s of %s" % \
(instance.getPortalType(), instance.getRelativeUrl())
raise NotImplementedError("Unknown portal type %s of %s" % \
(instance.getPortalType(), instance.getRelativeUrl()))
if requester is None:
# This instance has no successor (link removed) and should be trashed
......
......@@ -16,8 +16,8 @@ if (instance_tree.getSlapState() == "stop_requested"):
elif instance.getPortalType() == 'Slave Instance':
is_slave = True
else:
raise NotImplementedError, "Unknown portal type %s of %s" % \
(instance.getPortalType(), instance.getRelativeUrl())
raise NotImplementedError("Unknown portal type %s of %s" % \
(instance.getPortalType(), instance.getRelativeUrl()))
# Buildout may not propagate the stop request
requester = instance.getSuccessorRelatedValue()
......
......@@ -9,7 +9,7 @@ kwargs = state_change.kwargs
try:
compute_partition_url = kwargs['compute_partition_url']
except KeyError:
raise TypeError, "RequestedInstance_allocatePartition takes exactly 1 argument"
raise TypeError("RequestedInstance_allocatePartition takes exactly 1 argument")
assert instance.getAggregateValue() is None
compute_partition = portal.restrictedTraverse(compute_partition_url)
......
......@@ -26,7 +26,7 @@ request_software_instance_list = portal.portal_catalog(
limit=1,
)
if len(request_software_instance_list) == 1:
raise ValueError, "Too many instances '%s' found: %s" % (software_title, [x.path for x in request_software_instance_list])
raise ValueError("Too many instances '%s' found: %s" % (software_title, [x.path for x in request_software_instance_list]))
# Change the title
previous_title = instance.getTitle()
......
......@@ -4,7 +4,7 @@ instance = state_change['object']
try:
connection_xml = state_change.kwargs['connection_xml']
except KeyError:
raise TypeError, "RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
raise TypeError("RequestedInstance_updateConnectionInformation takes exactly 1 arguments")
edit_kw = {
'connection_xml': connection_xml,
......
......@@ -11,7 +11,7 @@ try:
sla_xml = kwargs["sla_xml"]
is_slave = kwargs["shared"]
except KeyError:
raise TypeError, "RequestedInstance_updateParameterInformation takes exactly 5 arguments"
raise TypeError("RequestedInstance_updateParameterInformation takes exactly 5 arguments")
edit_kw = {
'url_string': software_release_url_string,
......@@ -22,21 +22,21 @@ edit_kw = {
# Check the slave management
if is_slave not in [True, False]:
raise ValueError, "shared should be a boolean"
raise ValueError("shared should be a boolean")
instance_portal_type = instance.getPortalType()
if instance_portal_type == "Instance Tree":
edit_kw['root_slave'] = is_slave
elif instance_portal_type == "Software Instance":
if is_slave:
raise NotImplementedError, "Please destroy before doing a slave instance (%s)" % \
(instance.getRelativeUrl(), )
raise NotImplementedError("Please destroy before doing a slave instance (%s)" % \
(instance.getRelativeUrl(), ))
elif instance_portal_type == "Slave Instance":
if not is_slave:
raise NotImplementedError, "Please destroy before doing a software instance (%s)" % \
(instance.getRelativeUrl(), )
raise NotImplementedError("Please destroy before doing a software instance (%s)" % \
(instance.getRelativeUrl(), ))
else:
raise NotImplementedError, "Not supported portal type %s (%s)" % \
(instance.getPortalType(), instance.getRelativeUrl())
raise NotImplementedError("Not supported portal type %s (%s)" % \
(instance.getPortalType(), instance.getRelativeUrl()))
instance.edit(**edit_kw)
# Prevent storing broken XML in text content (which prevent to update parameters after)
......
......@@ -18,7 +18,7 @@ except KeyError:
#raise TypeError, "RequesterInstance_request takes exactly 7 arguments"
if is_slave not in [True, False]:
raise ValueError, "shared should be a boolean"
raise ValueError("shared should be a boolean")
# Instance tree is used as the root of the instance tree
if requester_instance.getPortalType() == "Instance Tree":
......@@ -66,7 +66,7 @@ if instance_count == 0:
elif instance_count == 1:
request_software_instance = request_software_instance_list[0].getObject()
else:
raise ValueError, "Too many instances '%s' found: %s" % (software_title, [x.path for x in request_software_instance_list])
raise ValueError("Too many instances '%s' found: %s" % (software_title, [x.path for x in request_software_instance_list]))
if (request_software_instance is None):
if (root_state == "destroyed"):
......@@ -146,7 +146,7 @@ if instance_found:
request_software_instance.requestDestroy(**promise_kw)
context.REQUEST.set('request_instance', None)
else:
raise ValueError, "state should be started, stopped or destroyed"
raise ValueError("state should be started, stopped or destroyed")
successor_list = requester_instance.getSuccessorList()
successor_uid_list = requester_instance.getSuccessorUidList()
......
......@@ -11,7 +11,7 @@ try:
# Aggregate can be None, so it isn't included on the kwargs
aggregate = kwargs["aggregate"]
except KeyError:
raise TypeError, "Person_requestSupportRequest takes exactly 3 arguments"
raise TypeError("Person_requestSupportRequest takes exactly 3 arguments")
aggregate_value = portal.restrictedTraverse(aggregate)
......
......@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try:
compute_node_title = kwargs['compute_node_title']
except KeyError:
raise TypeError, "Person_requestComputeNode takes exactly 1 argument"
raise TypeError("Person_requestComputeNode takes exactly 1 argument")
tag = "%s_%s_ComputeNodeInProgress" % (person.getUid(),
compute_node_title)
......
......@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try:
computer_network_title = kwargs['network_title']
except KeyError:
raise TypeError, "Person_requestNetwork takes exactly 1 argument"
raise TypeError("Person_requestNetwork takes exactly 1 argument")
tag = "%s_%s_NetworkInProgress" % (person.getUid(),
computer_network_title)
......
......@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try:
organisation_title = kwargs['organisation_title']
except KeyError:
raise TypeError, "Person_requestOrganisation takes exactly 1 argument"
raise TypeError("Person_requestOrganisation takes exactly 1 argument")
role_id = context.REQUEST.get("role_id", "client")
......
......@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try:
project_title = kwargs['project_title']
except KeyError:
raise TypeError, "Person_requestProject takes exactly 1 argument"
raise TypeError("Person_requestProject takes exactly 1 argument")
tag = "%s_%s_ProjectInProgress" % (person.getUid(),
project_title)
......
......@@ -14,10 +14,10 @@ try:
is_slave = kwargs["shared"]
root_state = kwargs["state"]
except KeyError:
raise TypeError, "Person_requestSoftwareInstance takes exactly 7 arguments"
raise TypeError("Person_requestSoftwareInstance takes exactly 7 arguments")
if is_slave not in [True, False]:
raise ValueError, "shared should be a boolean"
raise ValueError("shared should be a boolean")
instance_tree_portal_type = "Instance Tree"
......@@ -38,14 +38,14 @@ request_instance_tree_list = portal.portal_catalog(
limit=2,
)
if len(request_instance_tree_list) > 1:
raise NotImplementedError, "Too many instance tree %s found %s" % (software_title, [x.path for x in request_instance_tree_list])
raise NotImplementedError("Too many instance tree %s found %s" % (software_title, [x.path for x in request_instance_tree_list]))
elif len(request_instance_tree_list) == 1:
request_instance_tree = request_instance_tree_list[0].getObject()
if (request_instance_tree.getSlapState() == "destroy_requested") or \
(request_instance_tree.getTitle() != software_title) or \
(request_instance_tree.getValidationState() != "validated") or \
(request_instance_tree.getDestinationSection() != person.getRelativeUrl()):
raise NotImplementedError, "The system was not able to get the expected instance tree"
raise NotImplementedError("The system was not able to get the expected instance tree")
else:
if (root_state == "destroyed"):
# No need to create destroyed subscription.
......@@ -80,7 +80,7 @@ elif (root_state == "destroyed"):
request_instance_tree.requestDestroy(**promise_kw)
context.REQUEST.set('request_instance_tree', None)
else:
raise ValueError, "state should be started, stopped or destroyed"
raise ValueError("state should be started, stopped or destroyed")
request_instance_tree.requestInstance(
software_release=software_release_url_string,
......
......@@ -12,7 +12,7 @@ try:
# Aggregate can be None, so it isn't included on the kwargs
aggregate = kwargs.get("support_request_aggregate", None)
except KeyError:
raise TypeError, "Person_requestSupportRequest takes exactly 4 arguments"
raise TypeError("Person_requestSupportRequest takes exactly 4 arguments")
tag = "%s_%s_SupportRequestInProgress" % (person.getUid(),
support_request_title)
......
......@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try:
request_url = kwargs['request_url']
except KeyError:
raise TypeError, "Person_requestToken takes exactly 1 argument"
raise TypeError("Person_requestToken takes exactly 1 argument")
request_method = "POST"
access_token = portal.access_token_module.newContent(
......
......@@ -11,7 +11,7 @@ try:
text_content = kwargs['event_content']
source = kwargs['event_source']
except KeyError:
raise TypeError, "Ticket_requestEvent takes at exactly 3 argument"
raise TypeError("Ticket_requestEvent takes at exactly 3 argument")
web_message = portal.event_module.newContent(
portal_type="Web Message",
......
......@@ -14,7 +14,7 @@ try:
vads_url_success = kwargs['vads_url_success']
vads_url_return = kwargs['vads_url_return']
except KeyError:
raise TypeError, "PayzenEvent_generateNavigationPage takes exactly 6 arguments"
raise TypeError("PayzenEvent_generateNavigationPage takes exactly 6 arguments")
payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Transaction")
now = DateTime()
......@@ -22,7 +22,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
transaction_date, transaction_number = payment_transaction.PaymentTransaction_generatePayzenId()
if transaction_number is None:
raise ValueError, "Transaction already registered"
raise ValueError("Transaction already registered")
transaction_id = transaction_date.Date().replace("/", "") + "-" + transaction_number
......
......@@ -23,7 +23,7 @@ notification_message = portal.portal_notifications.getDocumentValue(
reference=notification_reference, language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
raise ValueError('Unable to found Notification Message with reference "%s".' % notification_reference)
# Set notification mapping
notification_mapping_dict = {
......
......@@ -18,7 +18,7 @@ notification_message = portal.portal_notifications.getDocumentValue(
reference=notification_reference, language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
raise ValueError('Unable to found Notification Message with reference "%s".' % notification_reference)
# Set notification mapping
notification_mapping_dict = {
......
......@@ -14,7 +14,7 @@ notification_reference = 'subscription_request-confirmation-%s' % notification_t
notification_message = portal.portal_notifications.getDocumentValue(reference=notification_reference,
language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
raise ValueError('Unable to found Notification Message with reference "%s".' % notification_reference)
if reference is None:
login_list = recipient.searchFolder(portal_type="ERP5 Login")
......
......@@ -7,7 +7,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
_, transaction_id = payment_transaction.PaymentTransaction_generateWechatId()
if transaction_id is None:
raise ValueError, "Transaction already registered"
raise ValueError("Transaction already registered")
wechat_dict = {
'out_trade_no': payment_transaction.getId().encode('utf-8'),
......
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