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

*: explicitly use activity="SQLDict" in activate 🤔

generated with nexedi/erp5$1185

I don't know if this is good or bad, but it shows all the places where
we implicitly use SQLDict.
parent e29c3c8c
......@@ -13,4 +13,4 @@ portal.portal_catalog.searchAndActivate(
activate_kw={'tag': tag},
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -317,4 +317,4 @@ with context.defaultActivateParameterDict({'tag': activity_tag}, placeless=True)
# make sure this Accounting Period has an activity pending during the indexing
# of the balance transaction.
context.activate(after_tag=activity_tag).getTitle()
context.activate(activity='SQLDict', after_tag=activity_tag).getTitle()
......@@ -42,7 +42,7 @@ for obj in object_list:
'portal_status_message': translateString('Payment creation already in progress, abandon.'),
'portal_status_level': 'error',
})
obj.activate(tag=tag).Invoice_createRelatedPaymentTransaction(
obj.activate(activity='SQLDict', tag=tag).Invoice_createRelatedPaymentTransaction(
node=node,
payment_mode=payment_mode,
payment=payment,
......@@ -58,7 +58,7 @@ if not activated:
})
# activate something on the folder
context.activate(after_tag=tag).getTitle()
context.activate(activity='SQLDict', after_tag=tag).getTitle()
return context.Base_redirect(
form_id,
......
......@@ -30,7 +30,7 @@ for obj in object_list:
"portal_status_message": translateString('Reversal creation already in progress, abandon.'),
"portal_status_level": 'error'
})
obj.activate(tag=tag).AccountingTransaction_createReversalTransaction(
obj.activate(activity='SQLDict', tag=tag).AccountingTransaction_createReversalTransaction(
cancellation_amount=cancellation_amount,
date=date,
plan=plan)
......@@ -45,7 +45,7 @@ if not activated:
))
# activate something on the folder
context.activate(after_tag=tag).getTitle()
context.activate(activity='SQLDict', after_tag=tag).getTitle()
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=
......
......@@ -6,5 +6,6 @@ tag = script.getId()
sci['object'].reindexObject(activate_kw={'tag': tag})
sci['object'].getPortalObject().account_module.activate(
activity='SQLDict',
after_tag=tag
).newCacheCookie("account_list")
......@@ -10,5 +10,5 @@ portal = accounting_period.getPortalObject()
profit_and_loss_account = portal.portal_workflow.getInfoFor(
accounting_period, 'profit_and_loss_account')
accounting_period.activate(after_method_id='unindexObject').AccountingPeriod_createBalanceTransaction(
accounting_period.activate(activity='SQLDict', after_method_id='unindexObject').AccountingPeriod_createBalanceTransaction(
profit_and_loss_account=profit_and_loss_account)
......@@ -6,4 +6,4 @@ accounting_period = sci['object']
if accounting_period.getParentValue().getPortalType() == accounting_period.getPortalType():
return
accounting_period.activate().AccountingPeriod_deleteBalanceTransaction()
accounting_period.activate(activity='SQLDict').AccountingPeriod_deleteBalanceTransaction()
......@@ -17,7 +17,7 @@ if portal.portal_activities.countMessageWithTag(tag) or \
return context.Base_redirect(form_id, keep_items=dict(
portal_status_message=translateString("Report already in progress.")))
context.activate().AccountingTransactionModule_viewFrenchAccountingTransactionFileActive(
context.activate(activity='SQLDict').AccountingTransactionModule_viewFrenchAccountingTransactionFileActive(
section_category,
section_category_strict,
from_date,
......
......@@ -106,7 +106,7 @@ for journal_code, journal_lib, journal_search_kw in _groupedJournalTupleDict():
# Proxy Role needed to create an 'Active Process'
this_journal_active_process=this_journal_active_process.getRelativeUrl())
context.activate(after_tag=(tag, aggregate_tag)).AccountingTransactionModule_aggregateFrenchAccountingTransactionFile(
context.activate(activity='SQLDict', after_tag=(tag, aggregate_tag)).AccountingTransactionModule_aggregateFrenchAccountingTransactionFile(
at_date,
active_process.getRelativeUrl(),
user_name=user_name,
......
......@@ -207,7 +207,7 @@ for section in section_list:
for line in payment.getMovementList(
portal_type=payment.getPortalAccountingMovementTypeList()):
if line.getGroupingReference():
line.activate(after_tag=tag).AccountingTransactionLine_resetGroupingReference()
line.activate(activity='SQLDict', after_tag=tag).AccountingTransactionLine_resetGroupingReference()
else:
# other cases not supported for now
......
......@@ -120,7 +120,7 @@ for month in range(1, month_count + 1):
for line in ptr.getMovementList(
portal_type=ptr.getPortalAccountingMovementTypeList()):
if line.getGroupingReference():
line.activate(after_tag=tag).AccountingTransactionLine_resetGroupingReference()
line.activate(activity='SQLDict', after_tag=tag).AccountingTransactionLine_resetGroupingReference()
accounting_module.setProperty('current_content_script',
......
......@@ -28,4 +28,4 @@ portal.portal_catalog.searchAndActivate(
activate_kw={'tag':tag, 'priority': 8},
**kw)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
ap = context.newActiveProcess()
context.activate(
activity='SQLDict',
active_process=ap.getRelativeUrl(),
tag=tag,
tag=tag
).Alarm_checkSkinCacheActive(fixit=fixit)
......@@ -3,7 +3,7 @@ def checkTopLevel():
for o in portal.objectValues():
error_list = o.checkFolderHandler(fixit=fixit)
if len(error_list):
portal.portal_activities.activate(active_process=active_process, priority=2) \
portal.portal_activities.activate(activity='SQLDict', active_process=active_process, priority=2) \
.Base_makeActiveResult(title=o.absolute_url_path(), error_list=error_list)
if 'tag' not in kwargs:
......
......@@ -25,6 +25,7 @@ for builder_id in builder_id_list:
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
limit=100,
serialization_tag=serialization_tag,
after_tag=after_tag,
......
......@@ -201,7 +201,7 @@ class ArchiveTool(BaseTool):
# Create inventory just before finish of hot reindexing
inventory_date = archive.getStopDateRangeMax()
self.activate(after_method_id=('playBackRecordedObjectList'),
self.activate(activity='SQLDict', after_method_id=('playBackRecordedObjectList'),
priority=5).runInventoryMethod(archive.id,
source_connection_id,
destination_sql_catalog_id,
......@@ -209,7 +209,7 @@ class ArchiveTool(BaseTool):
)
self.activate(after_method_id=('runInventoryMethod'),
self.activate(activity='SQLDict', after_method_id=('runInventoryMethod'),
after_tag="runInventoryMethod",
priority=5).InventoryModule_reindexMovementList(sql_catalog_id=destination_sql_catalog_id,
final_activity_tag="InventoryModule_reindexMovementList"
......
......@@ -20,5 +20,5 @@ failure_list = portal.portal_catalog(**kw)
for failure in failure_list:
tag = 'expire_%s' %failure.getUid()
failure.activate(tag = tag).expire(comment='System expire.')
failure.activate(after_tag = tag).reindexObject()
failure.activate(activity='SQLDict', tag=tag).expire(comment='System expire.')
failure.activate(activity='SQLDict', after_tag=tag).reindexObject()
......@@ -7,7 +7,7 @@ if context.getPortalObject().portal_activities.countMessageWithTag(tag):
return context.Base_redirect(form_id,
keep_items={'portal_status_message': translateString("Reconciliation already in progress"),})
context.activate(tag=tag).BankReconciliation_selectNonReconciledTransactionListActive(tag=tag)
context.activate(activity='SQLDict', tag=tag).BankReconciliation_selectNonReconciledTransactionListActive(tag=tag)
context.activate(after_tag=tag, activity='SQLQueue').BankReconciliation_notifySelectNonReconciledFinished()
......
......@@ -94,7 +94,7 @@ if use_activity:
method_kw['extra_header_dict'] = extra_header_dict
tag = script.id + '_reindex_' + context.getPath()
context.reindexObject(activate_kw={'tag': tag})
context.activate(after_tag=tag).MailMessage_sendByActivity(
context.activate(activity='SQLDict', after_tag=tag).MailMessage_sendByActivity(
method_kw=method_kw, **kw)
if download:
......
......@@ -12,5 +12,5 @@ if plugin_id in acl_users.plugins.getAllPlugins(plugin_type='IAuthenticationPlug
method_id='Person_migrateToERP5Login',
method_kw={'tag': tag},
)
portal.portal_activities.activate(after_tag=tag).ERP5Site_disableERP5UserManager()
portal.portal_activities.activate(activity='SQLDict', after_tag=tag).ERP5Site_disableERP5UserManager()
return error_list
......@@ -9,7 +9,7 @@ if document.getMetaType() == 'ERP5 OOo Document':
# Clear base_data
document.setBaseData(None)
tag = 'document_%s_convert' % document.getPath()
document.activate(tag=tag).Document_tryToConvertToBaseFormat()
document.activate(activity='SQLDict', tag=tag).Document_tryToConvertToBaseFormat()
else:
# do not run it in activity but not with try except statement
# Transaction must fail, otherwise data will be lost
......
......@@ -23,4 +23,4 @@ if document.hasBaseData():
if new_metadata:
# edit metadata via server
after_tag = 'document_%s_convert' % document.getPath()
document.activate(after_tag=after_tag).Document_tryToUpdateBaseMetadata(**new_metadata)
document.activate(activity='SQLDict', after_tag=after_tag).Document_tryToUpdateBaseMetadata(**new_metadata)
......@@ -4,4 +4,4 @@
that will update security groups.
"""
role_definition_parent = state_change['object'].getParentValue()
role_definition_parent.activate().updateLocalRolesOnSecurityGroups()
role_definition_parent.activate(activity='SQLDict').updateLocalRolesOnSecurityGroups()
......@@ -2,4 +2,4 @@ document = state_change['object']
if document.isSupportBaseDataConversion() and not document.hasBaseData():
document.processFile()
document.activate().convertToBaseFormat()
document.activate(activity='SQLDict').convertToBaseFormat()
......@@ -3,4 +3,4 @@ try:
delivery.aq_explicit.getCausalityState
except AttributeError:
return
delivery.activate(tag='build:'+delivery.getPath()).Delivery_calculate()
delivery.activate(activity='SQLDict', tag='build:'+delivery.getPath()).Delivery_calculate()
......@@ -6,5 +6,5 @@ solver_process = state_change['object'].getParentValue()
# could lead to the case where solver_process is never moved to succeeded
# Instead of using serialize (which may lead to conflicts), just use
# activities in queue.
solver_process.activate(serialization_tag=solver_process.getRelativeUrl()
solver_process.activate(activity='SQLDict', serialization_tag=solver_process.getRelativeUrl()
).SolverProcess_tryToSucceed()
......@@ -18,6 +18,7 @@ for builder_id in builder_id_list:
'Delivery_updateAppliedRule')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
serialization_tag=serialization_tag,
after_tag=after_tag,
after_method_id=after_method_id).build(activate_kw=activate_kw)
......@@ -572,7 +572,7 @@ class BusinessConfiguration(Item):
self.activate(**kw).ERP5Site_afterConfigurationSetup()
if self.portal_workflow.isTransitionPossible(self, 'install'):
self.activate(after_tag=kw["tag"]).install()
self.activate(activity='SQLDict', after_tag=kw["tag"]).install()
# Business Configuration are Item, which inherits from Amount and expect the
# resource category document to be an actual resource, but in the case of
......
......@@ -351,6 +351,7 @@ class ConfiguratorTool(BaseTool):
active_process = self.portal_activities.newActiveProcess()
REQUEST.set('active_process_id', active_process.getId())
business_configuration.activate(
activity='SQLDict',
active_process=active_process, tag='initialERP5Setup'
).build()
return self.ConfiguratorTool_viewInstallationStatus(REQUEST)
......@@ -7,7 +7,7 @@ bt = portal.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sampl
isTransitionPossible = portal.portal_workflow.isTransitionPossible
for obj in portal.portal_catalog(path=["%%/%s" % i.replace("**", "%") for i in bt.getTemplatePathList()]):
obj.activate().updateLocalRolesOnSecurityGroups()
obj.activate(activity='SQLDict').updateLocalRolesOnSecurityGroups()
for document in portal.portal_catalog(portal_type=bt.getTemplatePortalTypeRoleList()):
document.updateLocalRolesOnSecurityGroups()
......
......@@ -37,6 +37,7 @@ for builder_id in builder_id_list:
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
limit=100,
serialization_tag=serialization_tag,
after_tag=after_tag,
......
......@@ -34,6 +34,7 @@ for builder_id in builder_id_list:
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
limit=100,
serialization_tag=serialization_tag,
after_tag=after_tag,
......
......@@ -1146,7 +1146,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# Call once more to check cache.
self.assertEqual(pers.getDummyTypeBaseMethod(), pers.getId())
pers.activate().Person_getDummyTypeBaseMethodByActivity()
pers.activate(activity='SQLDict').Person_getDummyTypeBaseMethodByActivity()
self.tic()
def test_translate_table(self):
......
......@@ -134,7 +134,7 @@ class TestLocalizer(ERP5TypeTestCase):
)
tmp_obj = self.portal.portal_templates.newContent()
self.tic()
tmp_obj.activate().test_activity()
tmp_obj.activate(activity='SQLDict').test_activity()
# here we don't call self.tic() that calls self.portal that
# reinvoke setSite(portal).
setSite()
......@@ -181,7 +181,7 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€."))
""")
# normal activity
portal.portal_activities.activate().test_script()
portal.portal_activities.activate(activity='SQLDict').test_script()
self.tic()
# after activity execution we are still in english
self.assertEqual('en', localizer.get_selected_language())
......@@ -189,7 +189,7 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€."))
self.portal.Base_translateString("This is 1€."))
# execute activity with group_method
portal.portal_activities.activate(group_method_id=None).test_script()
portal.portal_activities.activate(activity='SQLDict', group_method_id=None).test_script()
self.tic()
# after activity execution we are still in english
self.assertEqual('en', localizer.get_selected_language())
......
......@@ -20,8 +20,9 @@ if prefs.getPreferredDeferredReportStoredAsDocument():
# pre-convert document before sending notification
if format:
document.activate(
activity='SQLDict',
node=portal.portal_preferences.getPreferredDeferredReportActivityFamily(),
tag=pre_convert_tag,
tag=pre_convert_tag
).convert(format=format)
url_base = portal.ERP5Site_getAbsoluteUrl()
......
......@@ -10,7 +10,7 @@ date_dict = {}
# Shared function
def updateDocumentList(**sql_kw):
for document in context.portal_catalog(**sql_kw):
document.getObject().activate().updateContentFromURL()
document.getObject().activate(activity='SQLDict').updateContentFromURL()
#Step1: convert the alarm date into hours
alarm_date = convertDateToHour()
......
......@@ -37,7 +37,7 @@ if candidate_type_list and current_type not in candidate_type_list:
'cancel_url': cancel_url})
context.edit(file=file)
context.activate().Document_convertToBaseFormatAndDiscoverMetadata(file_name=file_name)
context.activate(activity='SQLDict').Document_convertToBaseFormatAndDiscoverMetadata(file_name=file_name)
# Return to view mode
return context.Base_redirect(form_id, keep_items={'portal_status_message': translateString('File uploaded.')})
......@@ -8,4 +8,4 @@ if portal.portal_preferences.getPreferredDocumentConversionServerUrl():
document_relative_url = getRelativeUrl[index_uid]
document = portal.restrictedTraverse(document_relative_url)
if document.Base_isConvertible():
document.activate(priority=4, tag="conversion").Base_callPreConvert()
document.activate(activity='SQLDict', priority=4, tag="conversion").Base_callPreConvert()
......@@ -8,5 +8,5 @@ if context.hasBaseData():
quality = portal.portal_preferences.getPreferredImageQuality()
# empty documents do not need pre conversion
context.activate(serialization_tag='pre_convert').convert(**{'format': 'html'})
context.activate(serialization_tag='pre_convert').Base_preConvert(format, quality, display_list)
context.activate(activity='SQLDict', serialization_tag='pre_convert').convert(**{'format': 'html'})
context.activate(activity='SQLDict', serialization_tag='pre_convert').Base_preConvert(format, quality, display_list)
......@@ -7,7 +7,7 @@ format_kw = {'format': format,
'quality': quality}
for display in display_list:
format_kw['display'] = display
context.activate(serialization_tag='pre_convert').convert(**format_kw)
context.activate(activity='SQLDict', serialization_tag='pre_convert').convert(**format_kw)
# try to convert all relative referenced (i.e. by <img> tag) documents
context.activate().WebPage_preConvertReferencedImageList(**format_kw)
context.activate(activity='SQLDict').WebPage_preConvertReferencedImageList(**format_kw)
......@@ -7,7 +7,7 @@ format_kw = {'format': format,
'quality': quality}
for display in display_list:
format_kw['display'] = display
context.activate(serialization_tag='pre_convert').convert(**format_kw)
context.activate(activity='SQLDict', serialization_tag='pre_convert').convert(**format_kw)
# try to convert all relative referenced (i.e. by <img> tag) documents
context.activate().WebPage_preConvertReferencedImageList(**format_kw)
context.activate(activity='SQLDict').WebPage_preConvertReferencedImageList(**format_kw)
for email in context.portal_catalog(portal_type="Email Thread", validation_state="outgoing"):
email.getObject().activate().upload()
email.getObject().activate(activity='SQLDict').upload()
......@@ -12,4 +12,5 @@ for day in day_list[1:]:
activate_kw={"tag": tag})
# after indexing, make sure to update periodicity stop date
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(
activity='SQLDict',
after_tag=tag, priority=5).activeSense()
......@@ -8,4 +8,4 @@ if public_holiday_line.getValidationState() == "validated":
start_date = public_holiday_line.getStartDate()
quantity = public_holiday_line.getQuantity()
if not(None in (start_date, quantity)):
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(priority=5).activeSense()
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(activity='SQLDict', priority=5).activeSense()
# When updating public holidays, we have to recatalog group calendar
# assignments since they could be affected
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(priority=5).activeSense()
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(activity='SQLDict', priority=5).activeSense()
......@@ -18,4 +18,5 @@ if not(None in (day_of_week, quantity)):
time_table_line.setStopDate(stop_date)
# after change, make sure to update group calendars through the usual alarm
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(
activity='SQLDict',
priority=5).activeSense()
......@@ -507,6 +507,7 @@ class AmortisationRule(RuleMixin):
# Finally notify modified deliveries in order to update causality state
for delivery_value in to_notify_delivery_list:
delivery_value.activate(
activity='SQLDict',
after_tag='disconnect_amortisation_transaction'
).AmortisationTransaction_afterBuild()
delivery_value.edit()
......
......@@ -3,6 +3,7 @@ form_id='AccountingTransactionModule_viewAccountingTransactionList'
message='Building of Amortisation Transactions in progress...'
context.accounting_module.activate(
activity='SQLDict',
after_tag='expand_amortisation'
).AccountingTransactionModule_buildAmortisationTransaction(item_uid_list=item_uid_list,at_date=at_date)
......
context.activate(
activity='SQLDict',
tag='after_amortisation_build',
after_tag=('build_amortisation_transaction',
'disconnect_amortisation_transaction'),
'disconnect_amortisation_transaction')
).AmortisationTransaction_afterBuild(**kw)
......@@ -29,4 +29,4 @@ if context.getSimulationState() in context.getPortalUpdatableAmortisationTransac
#Test Add by Nicolas
if getattr(context, 'startBuilding', None) is not None:
context.startBuilding()
context.activate(after_tag='after_amortisation_build').updateCausalityState()
context.activate(activity='SQLDict', after_tag='after_amortisation_build').updateCausalityState()
......@@ -11,4 +11,4 @@ for movement in movement_list:
if item not in item_list:
item_list.append(item)
for item in item_list:
item.activate(tag='expand_amortisation', after_tag=tag, after_path_and_method_id=(movemement_path_list, ('updateImmobilisationState',) )).expandAmortisation()
item.activate(activity='SQLDict', tag='expand_amortisation', after_tag=tag, after_path_and_method_id=(movemement_path_list, ('updateImmobilisationState',) )).expandAmortisation()
......@@ -9,4 +9,4 @@ for movement in transaction.getMovementList():
"ProfitAndLoss")
# Automatic workflow
transaction.activate().updateCausalityState()
transaction.activate(activity='SQLDict').updateCausalityState()
......@@ -9,7 +9,7 @@ for movement in transaction.getMovementList():
# Update from simulation, then adapt causality value
transaction.getPortalObject().portal_deliveries.amortisation_transaction_builder.updateFromSimulation(transaction.getRelativeUrl())
tag = relative_url + '_afterBuild'
transaction.activate(tag=tag, after_tag=indexation_tag).AmortisationTransaction_afterBuild()
transaction.activate(activity='SQLDict', tag=tag, after_tag=indexation_tag).AmortisationTransaction_afterBuild()
# Automatic workflow
transaction.activate(after_tag=tag).updateCausalityState()
transaction.activate(activity='SQLDict', after_tag=tag).updateCausalityState()
......@@ -5,4 +5,4 @@ for movement in pl.getAggregatedItemsNextImmobilisationMovementValueList():
if movement.getImmobilisationState() != 'calculating':
movement.calculateImmobilisationValidity()
pl.activate(after_method_id=('recursiveReindexObject', 'immediateReindexObject',)).updateImmobilisationState()
pl.activate(activity='SQLDict', after_method_id=('recursiveReindexObject', 'immediateReindexObject',)).updateImmobilisationState()
......@@ -15,7 +15,8 @@ if person_value.getDefaultEmailText('') in ('', None):
portal_status_message=N_("You haven't defined your email address")))
context.activate(
tag=script.id,
activity='SQLDict',
tag=script.id
).LetterPostModule_exportExportableLetterPostActivity(
user.getUserId(),
comment,
......
......@@ -69,13 +69,13 @@ class MailevaSOAPConnector(XMLObject):
max_retry=0)
try:
response = suds.client.Client(url = self.getProperty('submit_url_string'), transport=authenticated).service.submit(__inject={'msg': maileva_exchange.getRequest()})
maileva_exchange.activate().MailevaExchange_processResponse(response)
maileva_exchange.activate(activity='SQLDict').MailevaExchange_processResponse(response)
except socket.error as e:
if e.errno == socket.errno.ECONNREFUSED:
if runtime_environment:
runtime_environment.edit(max_retry=None)
except Exception as e:
maileva_exchange.activate().MailevaExchange_processResponse(str(e), failed = True)
maileva_exchange.activate(activity='SQLDict').MailevaExchange_processResponse(str(e), failed = True)
......
......@@ -8,13 +8,13 @@ for event in portal.portal_catalog(
validation_state="confirmed"
):
if event.getReference() in notification_dict:
event.activate().MailevaExchange_checkStatus(track_id= notification_dict[event.getReference()]["id"])
event.activate(activity='SQLDict').MailevaExchange_checkStatus(track_id= notification_dict[event.getReference()]["id"])
elif getattr(event, 'track_id', ""):
event.activate().MailevaExchange_checkStatus(track_id= getattr(event, 'track_id'))
event.activate(activity='SQLDict').MailevaExchange_checkStatus(track_id= getattr(event, 'track_id'))
else:
if int(DateTime()) - int(event.getCreationDate()) > 60*60*24:
document = event.getFollowUpValue()
document.fail()
event.acknowledge(comment="No Response")
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -29,6 +29,6 @@ maileva_exchange = context.system_event_module.newContent(
request = xml
)
maileva_exchange.activate().MailevaExchange_submitMailevaRequest()
maileva_exchange.activate(activity='SQLDict').MailevaExchange_submitMailevaRequest()
context.send()
......@@ -4,4 +4,4 @@ context.getPortalObject().portal_catalog.searchAndActivate(
method_id='SoftwarePublication_submitSoftwarePublication',
activate_kw={'tag': tag}
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
software_release = context.SoftwarePublication_getRelatedSoftwareRelease()
tag = "publish_" + software_release.getRelativeUrl()
software_release.activate(tag=tag).SoftwareRelease_publishRelatedWebDocument()
software_release.activate(after_tag=tag).publish()
software_release.activate(activity='SQLDict', tag=tag).SoftwareRelease_publishRelatedWebDocument()
software_release.activate(activity='SQLDict', after_tag=tag).publish()
software_product = software_release.getFollowUpValue(portal_type="Software Product")
if software_product.getValidationStateTitle() == 'Draft':
software_product.validate()
......@@ -115,7 +115,7 @@ for name in zip_reader.namelist():
if url in ("index.html", "index.htm"):
default_page = document.getRelativeUrl()
web_manifest_url = extractWebManifest(document.getData())
document.activate(tag=tag, after_tag=doc_tag).publish()
document.activate(activity='SQLDict', tag=tag, after_tag=doc_tag).publish()
software_release.SoftwareRelease_fixRelatedWebSection(default_page=default_page, web_manifest = web_manifest_url)
......@@ -123,4 +123,4 @@ if portal.portal_workflow.isTransitionPossible(zip_file, 'publish'):
zip_file.publish()
if portal.portal_workflow.isTransitionPossible(software_release, 'submit'):
software_release.submit()
software_publication.activate(after_tag=tag).submit()
software_publication.activate(activity='SQLDict', after_tag=tag).submit()
......@@ -4,6 +4,7 @@ if web_page.getPublicationSection() == "application/landing_page":
if software_product:
# XXX Should be using an alarm
software_product.activate(
activity='SQLDict',
after_path_and_method_id=(
(web_page.getPath(),),
("immediateReindexObject", )
......
......@@ -3,4 +3,4 @@ web_site = software_product.getFollowUpValue(portal_type="Web Section")
if web_site:
tag = "SoftwareProduct_setReference_%s" % software_product.getUid()
software_product.reindexObject(activate_kw={"tag": tag})
software_product.activate(after_tag=tag).SoftwareProduct_fixRelatedWebSite()
software_product.activate(activity='SQLDict', after_tag=tag).SoftwareProduct_fixRelatedWebSite()
......@@ -51,8 +51,9 @@ if file not in ("undefined", None): # XXX "undefined" ? should also be fixed in
# XXX contribution API should allow to call a method on the final ingested document
# after ingestion is complete.
document.activate(
activity='SQLDict',
after_tag=ingest_document_tag,
tag=after_ingest_document_tag,
tag=after_ingest_document_tag
).Document_afterSupportRequestFilePostIngestion(
post_relative_url=post.getRelativeUrl(), )
else:
......@@ -60,6 +61,7 @@ else:
post.publish()
post.activate(
activity='SQLDict',
after_tag=after_ingest_document_tag
# XXX This API is not agreed. Also, we need to consider the possibility
# of ingesting posts through alarm, which is required when we want to ingest
......
......@@ -9,4 +9,4 @@ for payline_transaction in portal.payline_transaction_module.searchFolder(
# expiration_date=DateTime().strftime('<"%Y/%m/%d %H:%M:%S"'),
):
if countMessage(tag=tag, path=payline_transaction.path) == 0 and now > payline_transaction.getExpirationDate():
payline_transaction.activate(tag=tag).PaylineTransaction_inquiry(http_exchange_value=None)
payline_transaction.activate(activity='SQLDict', tag=tag).PaylineTransaction_inquiry(http_exchange_value=None)
......@@ -14,4 +14,4 @@ http_exchange = container.newContent(
http_exchange.confirm()
tag = script.id + '-' + http_exchange.getId()
http_exchange.reindexObject(activate_kw={'tag': tag})
portal.portal_alarms.handle_confirmed_http_exchanges.activate(after_tag=tag).activeSense()
portal.portal_alarms.handle_confirmed_http_exchanges.activate(activity='SQLDict', after_tag=tag).activeSense()
......@@ -7,7 +7,7 @@ if context.getPortalObject().portal_activities.countMessageWithTag(tag,):
return context.Base_redirect(form_id, keep_items=dict(portal_status_message=translateString(
"Some payments are still beeing processed in the background, please retry later")))
context.activate(tag=tag).PaymentTransactionGroup_selectPaymentTransactionLineListActive(
context.activate(activity='SQLDict', tag=tag).PaymentTransactionGroup_selectPaymentTransactionLineListActive(
uids=uids,
select_limit=select_limit,
start_date_range_min=start_date_range_min,
......
tag="PaymentTransactionGroup_cancel"
sci['object'].activate(after_tag="PaymentTransactionGroup_close", tag=tag).PaymentTransactionGroup_cancel(tag=tag)
sci['object'].activate(activity='SQLDict', after_tag="PaymentTransactionGroup_close", tag=tag).PaymentTransactionGroup_cancel(tag=tag)
......@@ -5,7 +5,7 @@ if len(uids):
for alarm in context.portal_alarms.searchFolder(uid=uids):
alarm.solve()
# Invoke activiveSense a bit later
alarm.activate().activeSense()
alarm.activate(activity='SQLDict').activeSense()
portal_status_message = N_("Site Configuration is going to be fixed by Activities.")
else:
portal_status_message = N_("No Site Configuration fix was request.")
......
......@@ -43,11 +43,11 @@ if configurator.getSimulationState() == "draft":
# create users if installation is done
try:
if create_test_data:
context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup',
context.portal_categories.activate(activity='SQLDict', after_method_id=('ERP5Site_afterConfigurationSetup',
'immediateReindexObject')
).ERP5Site_createTestData(user_quantity, password)
if set_id_generator:
context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup',
context.portal_categories.activate(activity='SQLDict', after_method_id=('ERP5Site_afterConfigurationSetup',
'immediateReindexObject')
).ERP5Site_setIdGenerator()
except Exception as e:
......
......@@ -6,6 +6,6 @@ if solver_process is not None:
solver_process.buildTargetSolverList()
solver_tag = '%s_solve' % delivery.getPath()
solver_process.solve(activate_kw={'tag':solver_tag})
delivery.activate(after_tag=solver_tag).updateCausalityState(solve_automatically=False)
delivery.activate(activity='SQLDict', after_tag=solver_tag).updateCausalityState(solve_automatically=False)
else:
delivery.updateCausalityState(solve_automatically=False)
......@@ -5,4 +5,4 @@ if not (hasattr(portal, 'portal_solvers') and hasattr(portal, 'portal_solver_pro
delivery.diverge()
else:
solver_tag = '%s_solve' % delivery.getPath()
delivery.activate(tag=solver_tag).Delivery_solveDivergenceAutomatically()
delivery.activate(activity='SQLDict', tag=solver_tag).Delivery_solveDivergenceAutomatically()
......@@ -733,7 +733,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for packing_list in module.contentValues(portal_type='Sale Packing List'):
divergence = packing_list.getDivergenceList()[0]
self.assertEqual(divergence.tested_property, solver_target)
packing_list.activate().SalePackingList_solveForTesting(
packing_list.activate(activity='SQLDict').SalePackingList_solveForTesting(
solver_target, divergence.prevision_value)
# XXX: Because divergence is ignored for 'destination_decision',
# its value is actually undefined after solving.
......@@ -754,7 +754,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
for packing_list in module.contentValues(portal_type='Sale Packing List'):
divergence = packing_list.getDivergenceList()[0]
self.assertEqual(divergence.tested_property, solver_target)
packing_list.activate().SalePackingList_solveForTesting(
packing_list.activate(activity='SQLDict').SalePackingList_solveForTesting(
solver_target, divergence.decision_value)
# Make sure that the same taget is not used again.
sequence.edit(solver_target=None)
......
......@@ -13,6 +13,7 @@ after_method_id = ('immediateReindexObject',
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
serialization_tag=serialization_tag,
after_tag=index_tag,
after_method_id=after_method_id).build(activate_kw=activate_kw)
......@@ -25,6 +25,7 @@ for builder_id in builder_id_list:
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
limit=100,
tag='invoice_builder_alarm',
serialization_tag=serialization_tag,
......@@ -33,4 +34,4 @@ for builder_id in builder_id_list:
# add a dummy activity so alarm calling can detect we still have a pending activity
# and do not start this script again before previous call is finished
context.activate(after_tag='invoice_builder_alarm').getId()
context.activate(activity='SQLDict', after_tag='invoice_builder_alarm').getId()
......@@ -26,6 +26,7 @@ for builder_id in builder_id_list:
'_updateSimulation')
activate_kw = dict(tag=index_tag)
builder.activate(
activity='SQLDict',
limit=100,
tag='packing_list_builder_alarm',
serialization_tag=serialization_tag,
......@@ -34,4 +35,4 @@ for builder_id in builder_id_list:
# add a dummy activity so alarm calling can detect we still have a pending activity
# and do not start this script again before previous call is finished
context.activate(after_tag='packing_list_builder_alarm').getId()
context.activate(activity='SQLDict', after_tag='packing_list_builder_alarm').getId()
......@@ -10,5 +10,6 @@ for brain in portal.portal_catalog(
):
stripe_payment_session = brain.getObject()
stripe_payment_session.activate(
tag=tag,
activity='SQLDict',
tag=tag
).StripePaymentSession_checkStripeSessionOpen()
......@@ -25,4 +25,4 @@ context.setFollowUpValue(stripe_payment_session)
# activate alarm after the payment session is reindexed
alarm = portal.portal_alarms.check_stripe_payment_session
alarm.activate(queue='SQLQueue', after_tag=tag).activeSense()
alarm.activate(activity='SQLDict', queue='SQLQueue', after_tag=tag).activeSense()
......@@ -3,7 +3,7 @@ import json
response = connector.createSession(data=data)
assert "id" in response, response
context.activate().StripePaymentSessionModule_storeStripeSession(
context.activate(activity='SQLDict').StripePaymentSessionModule_storeStripeSession(
reference=response["id"],
expiration_date=context.getTypeBasedMethod('getStripePaymentSessionExpirationDate')(),
resource=resource,
......
......@@ -262,10 +262,10 @@ class SyncMLAsynchronousEngine(SyncMLEngineMixin):
)
# then send the final message of this sync part
if pref.getPreferredCheckDeleteAtEnd():
subscription.activate(after_tag=tag,
subscription.activate(activity='SQLDict', after_tag=tag,
priority=ACTIVITY_PRIORITY+1).getDeletedSyncMLData()
else:
subscription.activate(after_tag=tag,
subscription.activate(activity='SQLDict', after_tag=tag,
priority=ACTIVITY_PRIORITY+1)._sendFinalMessage()
return True
......
......@@ -4,5 +4,5 @@ for exchange in context.getPortalObject().system_event_module.searchFolder(
validation_state='confirmed',
):
if exchange.getValidationState() == 'confirmed':
exchange.activate(tag=tag).HTTPExchange_setFollowUpAndInquiry()
exchange.activate(activity='SQLDict', tag=tag).HTTPExchange_setFollowUpAndInquiry()
exchange.acknowledge()
......@@ -34,4 +34,4 @@ for section_info in context.TaxReturn_getSectionInformationList():
movement.getObject().edit(activate_kw=dict(tag=tag),
aggregate_value=context)
context.activate(after_tag=tag).getTitle()
context.activate(activity='SQLDict', after_tag=tag).getTitle()
vat_return = sci['object']
vat_return.activate().VatReturn_setAggregateList()
vat_return.activate(activity='SQLDict').VatReturn_setAggregateList()
......@@ -277,7 +277,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
test_node = test_node_module.newContent(portal_type="Test Node", title=title, computer_guid=computer_guid,
specialise=self.getRelativeUrl(),
activate_kw={'tag': tag})
self.activate(after_tag=tag).optimizeConfiguration()
self.activate(activity='SQLDict', after_tag=tag).optimizeConfiguration()
test_node.setPingDate()
if batch_mode:
return config
......@@ -357,7 +357,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
test_node = test_node_module.newContent(portal_type="Test Node", title=title,
specialise=self.getRelativeUrl(),
activate_kw={'tag': tag})
self.activate(after_tag=tag).optimizeConfiguration()
self.activate(activity='SQLDict', after_tag=tag).optimizeConfiguration()
test_node.setPingDate()
choice_list = self._getSortedNodeTestSuiteToRun(test_node)
for test_suite in choice_list:
......
......@@ -31,7 +31,7 @@ portal = context.getPortalObject()
distributor_list = portal.portal_task_distribution.objectValues()
for distributor in distributor_list:
distributor.activate(tag=tag).optimizeConfiguration()
distributor.activate(activity='SQLDict', tag=tag).optimizeConfiguration()
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
return list_node
#Clean-up inactive Test Nodes
context.portal_alarms.task_distributor_alarm_optimize.activate(after_path=context.getPath()).activeSense()
context.portal_alarms.task_distributor_alarm_optimize.activate(activity='SQLDict', after_path=context.getPath()).activeSense()
......@@ -8,4 +8,4 @@ testnode will do the job.
portal = context.getPortalObject()
for test_result in portal.portal_catalog(portal_type="Test Result",
simulation_state="started"):
test_result.getObject().activate(priority=5).TestResult_restartStuckLine()
test_result.getObject().activate(activity='SQLDict', priority=5).TestResult_restartStuckLine()
......@@ -259,7 +259,7 @@ class TaskDistributionTool(BaseTool):
line.stop(**status_dict)
# Check by activity is all lines are finished. Do not check synchrnonously
# in case another test line is stopped in parallel
test_result.activate().TestResult_stopIfFinished()
test_result.activate(activity='SQLDict').TestResult_stopIfFinished()
def _extractXMLRPCDict(self, xmlrpc_dict):
"""
......
......@@ -58,7 +58,7 @@ if test_result.getPortalType() == 'Test Result':
else:
status = 'PASS'
test_result.edit(string_index=status, **edit_kw)
test_result.activate().TestResult_afterComplete()
test_result.activate(activity='SQLDict').TestResult_afterComplete()
elif test_result.getPortalType() == 'Test Result Line':
all_tests = kw.get('test_count')
errors = kw.get('error_count', 0)
......
......@@ -290,8 +290,8 @@ class ERP5ResourceConduit(TioSafeBaseConduit):
document.portal_workflow.doActionFor(document, action)
except WorkflowException:
if current_state == 'draft':
document.activate().validate()
document.activate().invalidate()
document.activate(activity='SQLDict').validate()
document.activate(activity='SQLDict').invalidate()
# Remove related line from sale supply
sync_name = self.getIntegrationSite(kw['domain']).getTitle()
......
......@@ -38,7 +38,7 @@ for sync in sync_list:
portal_status_message = translateString("Synchronization started.")
# Add to the integration site view the clock which show activities -Aurel : really necessary ?
context.activate(after_tag=after_tag).getTitle()
context.activate(activity='SQLDict', after_tag=after_tag).getTitle()
if not batch_mode:
context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_status_message))
......
......@@ -4,7 +4,7 @@ context.setTotalAssetPrice(0)
context.calculate()
context.activate().InventoryReport_recordProductStock()
context.activate(activity='SQLDict').InventoryReport_recordProductStock()
if not batch_mode:
message = context.Base_translateString("Product Stock is creating")
return context.Base_redirect('view',keep_items={'portal_status_message': message})
......@@ -27,7 +27,8 @@ for inventory in inventory_list:
total_asset_price=0
)
inventory_report_line.activate(
tag = line_tag
activity='SQLDict',
tag=line_tag
).InventoryReportLine_updateTotalAssetPrice(
section_uid = section_uid,
node_uid = node_uid,
......@@ -39,5 +40,5 @@ for inventory in inventory_list:
)
tag = '%s:updateTotalAssetPrice' % relative_url
context.activate(after_tag=line_tag, tag=tag).InventoryReport_updateTotalAssetPrice()
context.activate(after_tag=tag).record()
context.activate(activity='SQLDict', after_tag=line_tag, tag=tag).InventoryReport_updateTotalAssetPrice()
context.activate(activity='SQLDict', after_tag=tag).record()
......@@ -81,7 +81,7 @@ select_params = {
active_process_value = portal.portal_activities.newContent(
portal_type='Active Process',)
catalog_params.update(select_params)
portal.portal_catalog.activate(tag=tag).searchAndActivate(
portal.portal_catalog.activate(activity='SQLDict', tag=tag).searchAndActivate(
method_id="OrderModule_processOrderStat",
method_kw = {'active_process' : active_process_value.getPath(),
'line_params' : line_params,
......
......@@ -117,9 +117,10 @@ class TestERP5Simulation(TestPackingListMixin, SecurityTestCase):
if previous_tag:
after_tag.append(previous_tag)
delivery_builder.activate(
activity='SQLDict',
after_method_id=('solve',
'immediateReindexObject'), # XXX too brutal.
after_tag=after_tag,
after_tag=after_tag
).build(explanation_uid=packing_list.getCausalityValue().getUid())
def stepCheckPackingListSplitted(self, sequence=None, sequence_list=None, **kw):
......
......@@ -986,9 +986,10 @@ class TestPackingListMixin(TestOrderMixin):
if previous_tag:
after_tag.append(previous_tag)
delivery_builder.activate(
activity='SQLDict',
after_method_id=('solve',
'immediateReindexObject'), # XXX too brutal.
after_tag=after_tag,
after_tag=after_tag
).build(explanation_uid=packing_list.getCausalityValue().getUid())
def stepMergeSplittedPackingList(self, sequence=None):
......
......@@ -11,4 +11,4 @@ if getattr(delivery, 'calculatePacking', None) is not None:
tag = script.id + '_' + container.getPath()
# XXX: Tagged reindexation added to replace after_path_and_method_id. May be unnecessary.
container.recursiveReindexObject(activate_kw={'tag': tag})
delivery.activate(after_tag=tag).calculatePacking()
delivery.activate(activity='SQLDict', after_tag=tag).calculatePacking()
......@@ -9,4 +9,4 @@ portal.portal_catalog.searchAndActivate(
creation_date = Query(creation_date=addToDate(DateTime(), to_add={'day': -120}), range="min"),
activate_kw={'tag': tag},
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -9,4 +9,4 @@ portal.portal_catalog.searchAndActivate(
creation_date = Query(creation_date=addToDate(DateTime(), to_add={'day': -90}), range="min"),
activate_kw={'tag': tag},
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -4,4 +4,4 @@ portal.portal_catalog.searchAndActivate(
method_id='TravelRequest_createRepresentativeRecord',
activate_kw={'tag': tag},
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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