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

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

generated with $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',
Please register or sign in to reply
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()
Please register or sign in to reply
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',
  • this one might be a bug ( edit: probably not )

    Edited by Jérome Perrin
  • Well, removing a trailing comma is a bug :) . Trailing commas are good for diffs !

  • yes, actually I looked a bit at this a bit and I was thinking it might be a bug bowler. I don't know how much it is maintained these days, in https://github.com/facebookincubator/Bowler#current-development-status they explain that the technologies they use ( lib2to3's grammar ) do not support new language features of python3 . They recommend using LibCST instead, but it seems LibCST does not support python2 syntax. BTW @xavier_thompson did you know about this ? @arnau raised this as a problem for my2to3

    In any case, this seems fixable, but that was good enough for a first step at "let's see what's impacted by this default value"

Please register or sign in to reply
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()
......@@ -47,7 +47,7 @@ if fixit:
# start another activity to collect the results from each upgrader step
context.activate(after_tag=(upgrade_tag, post_upgrade_tag)).Alarm_postFullUpgradeNeed(
context.activate(activity='SQLDict', after_tag=(upgrade_tag, post_upgrade_tag)).Alarm_postFullUpgradeNeed(
active_process=active_process.getRelativeUrl())
# Nothing else to do, so we can disable.
......
......@@ -95,6 +95,7 @@ pref.setPreferredAccountingTransactionSourceSection(my_organisation.getRelativeU
pref.setPreferredHtmlStyleUnsavedFormWarning(False)
my_organisation.activate(
activity='SQLDict',
after_path_and_method_id=(
my_organisation.getPath(), ('immediateRecusriveReindexObject', 'immediateReindexObject'))) \
.Organisation_addConditionallyAccountingPeriod()
......
......@@ -10,4 +10,4 @@ for path in path_list:
filename = document.getFilename()
# Now starts metadata discovery process
document.activate().discoverMetadata(filename=filename, input_parameter_dict=input_parameter_dict)
document.activate(activity='SQLDict').discoverMetadata(filename=filename, input_parameter_dict=input_parameter_dict)
......@@ -33,7 +33,7 @@ module.activate(tag=tag, activity='SQLQueue').EventModule_addWebMessage(**edit_k
# Trigger explicitly the alarm which will run discoverMetadata on created event, then
# Fill in discoverable properties (sender, recipient, ...) and change workflow states.
# XXX hardcoded id, must be picked up by reference and version API
portal.portal_alarms.fetch_incoming_web_message_list.activate(after_tag=tag).activeSense()
portal.portal_alarms.fetch_incoming_web_message_list.activate(activity='SQLDict', after_tag=tag).activeSense()
portal_status_message = translate('Your message has been successfully submitted.')
context.getWebSectionValue().getParentValue().Base_redirect(keep_items={'portal_status_message': portal_status_message})
......@@ -15,4 +15,4 @@ if not portal_preferences.isPreferredHtmlStyleDisabled():
preferred_html_style_disabled=True
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -15,4 +15,4 @@ if portal_preferences.isPreferredHtmlStyleDisabled():
preferred_html_style_disabled=False
)
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
......@@ -5,5 +5,5 @@ with context.foo_module.defaultActivateParameterDict({'tag': activity_tag}, plac
foo1.setTitle('hasAccessUnauthorized')
foo1.setSuccessorValue(foo2)
foo2.activate(after_tag=activity_tag).manage_permission('Access contents information', 'Manager', 0)
foo2.activate(activity='SQLDict', after_tag=activity_tag).manage_permission('Access contents information', 'Manager', 0)
return 'Done'
......@@ -719,7 +719,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
user = uf.getUserById('toto').__of__(uf)
newSecurityManager(None, user)
# Execute something as toto
organisation.activate().newContent(portal_type='Email',id='email')
organisation.activate(activity='SQLDict').newContent(portal_type='Email',id='email')
# Then execute activities as seb
user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user)
......@@ -829,7 +829,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(len(activity_tool.getMessageList()), 0)
# Insert a failing active object.
obj.activate().failingMethod()
obj.activate(activity='SQLDict').failingMethod()
self.commit()
self.assertEqual(len(activity_tool.getMessageList()), 1)
......@@ -1030,7 +1030,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
if property_id.startswith('_v_'):
delattr(activity_tool, property_id)
organisation_module = self.getOrganisationModule()
active_organisation_module = organisation_module.activate()
active_organisation_module = organisation_module.activate(activity='SQLDict')
delete_volatiles()
# Cause a message to be created
# If the buffer cannot be created, this will raise
......@@ -1361,8 +1361,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
]
def activate(serialization_tag='a'):
organisation.activate(
activity='SQLDict',
serialization_tag=serialization_tag,
group_method_id='portal_catalog/catalogObjectList',
group_method_id='portal_catalog/catalogObjectList'
).getTitle()
organisation = self.portal.organisation_module.newContent(portal_type='Organisation')
self.tic()
......@@ -1560,7 +1561,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
portal_type='Organisation', id='test_obj')
self.assertEqual(o.absolute_url(),
'http://test.erp5.org:9080/virtual_root/test_obj')
o.activate().checkAbsoluteUrl()
o.activate(activity='SQLDict').checkAbsoluteUrl()
# Reset server URL and virtual root before executing messages.
# This simulates the case of activities beeing executed with different
......@@ -1864,7 +1865,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
from Products.ZMySQLDA.db import DB
DB.original_query = DB.query
try:
active_object.activate().getTitle()
active_object.activate(activity='SQLDict').getTitle()
self.commit()
self.assertTrue(active_object.hasActivity())
# Make the sql request not working
......@@ -2451,9 +2452,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
def test_getMessageList(self):
activity_tool = self.portal.portal_activities
module = self.portal.person_module
module.activate(after_tag="foo").getUid()
module.activate(activity='SQLDict', after_tag="foo").getUid()
module.activate(activity='SQLQueue', tag="foo").getId()
activity_tool.activate(priority=-1).getId()
activity_tool.activate(activity='SQLDict', priority=-1).getId()
def check(expected, **kw):
self.assertEqual(expected, len(activity_tool.getMessageList(**kw)))
def test(check=lambda _, **kw: check(0, **kw)):
......@@ -2518,13 +2519,13 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
def test_activateOnZsqlBrain(self):
organisation, = self.getOrganisationModule().searchFolder(
id=self.company_id)
organisation.activate().getTitle()
organisation.activate(activity='SQLDict').getTitle()
self.tic()
def test_flushActivitiesOnDelete(self):
organisation = self.getOrganisation()
organisation.getParentValue()._delObject(organisation.getId())
organisation.activate().getTitle()
organisation.activate(activity='SQLDict').getTitle()
self.tic()
def test_flushActivitiesOnDeleteWithAcquierableObject(self):
......@@ -2760,9 +2761,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
organisation = self.portal.organisation_module.newContent(portal_type='Organisation')
self.tic()
activity_tool = self.getActivityTool()
organisation.activate(tag='1').getId()
organisation.activate(tag='2', after_tag=None).getId()
organisation.activate(tag='3', after_tag='foo').getId()
organisation.activate(activity='SQLDict', tag='1').getId()
organisation.activate(activity='SQLDict', tag='2', after_tag=None).getId()
organisation.activate(activity='SQLDict', tag='3', after_tag='foo').getId()
self.commit()
activity_tool.getMessageList()
self.assertItemsEqual(
......@@ -2790,7 +2791,7 @@ return [x.getObject() for x in context.portal_catalog(limit=100)]
import Products.ERP5Type.Timeout
Products.ERP5Type.Timeout.activity_timeout = 2.0
self.portal.portal_templates.activate().Base_getSlowObjectList()
self.portal.portal_templates.activate(activity='SQLDict').Base_getSlowObjectList()
with self.assertRaises(RuntimeError):
self.tic()
message, = self.getMessageList('SQLDict')
......
......@@ -186,7 +186,7 @@ class Alarm(XMLObject, PeriodicityMixin):
# Old API
getattr(self.activate(**activate_kw), method_id)()
if self.isAlarmNotificationMode():
self.activate(after_tag=tag).notify(include_active=True, params=params)
self.activate(activity='SQLDict', after_tag=tag).notify(include_active=True, params=params)
# switch to nobody temporarily so that unrestricted _activeSense
# is always invoked by system user.
......@@ -294,7 +294,7 @@ class Alarm(XMLObject, PeriodicityMixin):
"""
method_id = self.getSolveMethodId()
if method_id not in (None, ''):
method = getattr(self.activate(), method_id)
method = getattr(self.activate(activity='SQLDict'), method_id)
return method()
return self.activeSense(fixit=1)
......
......@@ -69,4 +69,4 @@ class MetaNode(Node):
Lookup for capacities children of self and update capacity attributes
by calling portal simulation (deferred)
"""
self.activate().immediateUpdateCapacity()
self.activate(activity='SQLDict').immediateUpdateCapacity()
......@@ -1994,7 +1994,7 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
tool_id = tool.id
if tool_id not in ('portal_property_sheets', 'portal_components'):
if tool_id in ('portal_categories', ):
tool = tool.activate()
tool = tool.activate(activity='SQLDict')
tool.migrateToPortalTypeClass(tool_id not in (
'portal_activities', 'portal_simulation', 'portal_templates',
'portal_trash', 'portal_catalog'))
......@@ -2158,15 +2158,18 @@ class ERP5Generator(PortalGenerator):
p.portal_templates.repository_dict = dict.fromkeys(bt5_repository_url.split())
if bt5:
p.portal_templates.activate(
# XXX: Is it useful to wait for indexing ?
activity='SQLDict',
# XXX: Is it useful to wait for indexing ?
after_tag=reindex_all_tag,
tag=upgrade_tag,
tag=upgrade_tag
).upgradeSite(bt5.split(), update_catalog=True)
# XXX: workaround for the above BT installation not using the upgrader,
# and hence not triggering post-install constraints.
if 'erp5_oauth2_authorisation' in bt5:
p.portal_templates.activate(
after_tag=upgrade_tag,
activity='SQLDict',
after_tag=upgrade_tag
).ERP5Site_checkOAuth2AuthorisationServerPostUpgradeConsistency(fixit=True)
if id_store_interval != '':
id_store_interval = int(id_store_interval)
......
......@@ -127,7 +127,7 @@ def updateBalanceTransactionClass(self):
# XXX 'something' activates some unindexObject calls, so activate our
# reindexing after ...
newobj.activate(after_method_id='unindexObject').recursiveReindexObject()
newobj.activate(activity='SQLDict', after_method_id='unindexObject').recursiveReindexObject()
def updateCareerValidationState(self):
......
......@@ -52,4 +52,4 @@ class ProfitAndLoss(CopyToTarget):
simulation_movement.edit(profit_quantity=added_quantity)
tag = 'ProfitAndLoss_solve_' + simulation_movement.getPath()
simulation_movement.reindexObject(activate_kw={'tag': tag})
delivery_line.activate(after_tag=tag).edit()
delivery_line.activate(activity='SQLDict', after_tag=tag).edit()
......@@ -357,8 +357,9 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
if calculate:
path = self.getPath()
self.activate(
activity='SQLDict',
after_tag='build:'+path,
after_path_and_method_id=(path, '_localBuild'),
after_path_and_method_id=(path, '_localBuild')
).updateCausalityState()
if kw:
super(Delivery, self).updateSimulation(**kw)
......@@ -402,7 +403,7 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
build_tag = '%s_splitAndDefer_build' % self.getRelativeUrl()
# call solver and expand on deferrd movements
for movement in movement_list:
movement.activate(tag=solver_tag).Movement_solveMovement(
movement.activate(activity='SQLDict', tag=solver_tag).Movement_solveMovement(
delivery_solver, target_solver)
tag_list.append(solver_tag)
kw = {'after_tag': tag_list[:], 'tag': expand_tag}
......@@ -420,14 +421,14 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
for s_m in movement.getDeliveryRelatedValueList():
delivery_list = \
[x for x in s_m.getDeliveryList() if x != movement_url]
s_m.activate(after_tag=tag_list[:], tag=detach_tag).setDeliveryList(
s_m.activate(activity='SQLDict', after_tag=tag_list[:], tag=detach_tag).setDeliveryList(
delivery_list)
detached_movement_url_list.append(s_m.getRelativeUrl())
tag_list.append(detach_tag)
#delete delivery movements
# deleteContent uses the uid as a activity tag
self.activate(after_tag=tag_list[:]).deleteContent([movement.getId() for
self.activate(activity='SQLDict', after_tag=tag_list[:]).deleteContent([movement.getId() for
movement in movement_list])
tag_list.extend(deleted_movement_uid_list)
......@@ -437,7 +438,7 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
# call builder on detached movements
builder = getattr(self.portal_deliveries, delivery_builder)
builder.activate(after_tag=tag_list[:], tag=build_tag).build(
builder.activate(activity='SQLDict', after_tag=tag_list[:], tag=build_tag).build(
movement_relative_url_list=detached_movement_url_list)
......
......@@ -1081,6 +1081,7 @@ class ImmobilisableItem(Item, Amount):
activate_kw={'tag': 'expand_amortisation'},
)
self.activate(
activity='SQLDict',
after_path_and_method_id=(
[x.getPath() for x in related_packing_list_list],
('updateImmobilisationState', ),
......@@ -1103,7 +1104,7 @@ class ImmobilisableItem(Item, Amount):
for delivery in delivery_list:
if getattr(delivery, 'updateImmobilisationState', None) is not None:
delivery.updateImmobilisationState()
self.activate().expandAmortisation(activate_kw=activate_kw)
self.activate(activity='SQLDict').expandAmortisation(activate_kw=activate_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionMovementValueList')
def getSectionMovementValueList(self, include_to_date=0, **kw):
......
......@@ -92,7 +92,7 @@ class _Policy(object):
self.test = self.activate
def activate(self, context):
context.activate(merge_parent=self.merge_parent) \
context.activate(activity='SQLDict', merge_parent=self.merge_parent) \
.expand(activate_kw=self.activate_kw)
def __call__(self, *args):
......
......@@ -20,9 +20,10 @@ def reindex(document_list, tag, after_tag):
for document in document_list:
print('#### Indexing %s ####')
document.activate(
activity='SQLDict',
priority=additional_priority,
tag=tag,
after_tag=after_tag,
after_tag=after_tag
).recursiveReindexObject(
activate_kw={
'tag': tag,
......@@ -110,7 +111,8 @@ print(reindex(
))
portal.portal_activities.activate(
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag),
activity='SQLDict',
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag)
).InventoryModule_reindexMovementList(
sql_catalog_id=sql_catalog_id,
final_activity_tag=last_inventory_tag,
......@@ -119,11 +121,13 @@ portal.portal_activities.activate(
# restore alarm node
if clear_catalog and is_subscribed:
portal.portal_alarms.activate(
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag, last_inventory_tag),
activity='SQLDict',
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag, last_inventory_tag)
).subscribe()
portal.portal_activities.activate(
activity='SQLDict',
tag=final_activity_tag,
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag, last_inventory_tag),
after_tag=(user_tag, category_tag, document_tag, preference_tag, inventory_tag, simulation_tag, last_inventory_tag)
).getId()
return printed
......@@ -52,7 +52,7 @@ portal.portal_catalog.searchAndActivate(
# activate something on the module after everything, so that user can know that
# something is happening in the background
context.activate(after_tag=tag).getId()
context.activate(activity='SQLDict', after_tag=tag).getId()
return context.Base_redirect(form_id,
keep_items=dict(portal_status_message=translate("Workflow modification in progress.")))
......@@ -82,7 +82,7 @@ for i in xrange(0, path_list_len, batch_size):
# activate something on the module after everything, so that user can know that
# something is happening in the background
context.activate(after_tag=tag).getTitle()
context.activate(activity='SQLDict', after_tag=tag).getTitle()
# reset selection checked uids
context.portal_selections.setSelectionCheckedUidsFor(selection_name, [])
......
......@@ -29,4 +29,4 @@ for inventory in portal.portal_catalog(portal_type=portal_type_list,
if final_activity_tag is not None and previous_tag is not None:
# Dummy activity used to determine if the previously started activities are over.
context.activate(tag=final_activity_tag, after_tag=previous_tag).getId()
context.activate(activity='SQLDict', tag=final_activity_tag, after_tag=previous_tag).getId()
......@@ -212,7 +212,7 @@ class ContributionTool(BaseTool):
# if _setObject is not called
document = container.newContent(document_id, portal_type, **kw)
if discover_metadata:
document.activate(after_path_and_method_id=(document.getPath(),
document.activate(activity='SQLDict', after_path_and_method_id=(document.getPath(),
('convertToBaseFormat', 'Document_tryToConvertToBaseFormat')))\
.discoverMetadata(filename=filename,
user_login=user_login,
......@@ -404,10 +404,11 @@ class ContributionTool(BaseTool):
# be for user interface and should thus be handled by
# ZODB scripts
document.activate(
activity='SQLDict',
after_path_and_method_id=(
document.getPath(),
('convertToBaseFormat', 'Document_tryToConvertToBaseFormat'),
),
)
).discoverMetadata(filename=filename,
user_login=user_login,
input_parameter_dict=input_parameter_dict)
......@@ -552,7 +553,7 @@ class ContributionTool(BaseTool):
if repeat == 0 or not batch_mode:
# XXX - Call the extendBadURLList method,--NOT Implemented--
raise
content.activate(at_date=DateTime() + repeat_interval).updateContentFromURL(repeat=repeat - 1)
content.activate(activity='SQLDict', at_date=DateTime() + repeat_interval).updateContentFromURL(repeat=repeat - 1)
return
content._edit(file=file_object, content_type=content_type)
......@@ -562,17 +563,17 @@ class ContributionTool(BaseTool):
# not here (look at _edit in Base)
# Step 2: convert to base format
if content.isSupportBaseDataConversion():
content.activate().Document_tryToConvertToBaseFormat()
content.activate(activity='SQLDict').Document_tryToConvertToBaseFormat()
# Step 3: run discoverMetadata
content.activate(after_path_and_method_id=(content.getPath(),
content.activate(activity='SQLDict', after_path_and_method_id=(content.getPath(),
('convertToBaseFormat', 'Document_tryToConvertToBaseFormat'))) \
.discoverMetadata(filename=filename)
# Step 4: activate populate (unless interaction workflow does it)
content.activate().populateContent()
content.activate(activity='SQLDict').populateContent()
# Step 5: activate crawlContent
depth = content.getCrawlingDepth()
if depth > 0:
content.activate().crawlContent()
content.activate(activity='SQLDict').crawlContent()
security.declareProtected(Permissions.AddPortalContent, 'newContentFromURL')
def newContentFromURL(self, url, container_path=None, id=None, repeat=MAX_REPEAT,
......@@ -593,10 +594,10 @@ class ContributionTool(BaseTool):
document = self.newContent(container_path=container_path, url=url, **kw)
if document.isIndexContent() and document.getCrawlingDepth() >= 0:
# If this is an index document, keep on crawling even if crawling_depth is 0
document.activate().crawlContent()
document.activate(activity='SQLDict').crawlContent()
elif document.getCrawlingDepth() > 0:
# If this is an index document, stop crawling if crawling_depth is 0
document.activate().crawlContent()
document.activate(activity='SQLDict').crawlContent()
except urllib.error.HTTPError:
if repeat == 0 or not batch_mode:
# here we must call the extendBadURLList method,--NOT Implemented--
......
......@@ -4,10 +4,10 @@ from Products.CMFCore.utils import getToolByName
if cache_plugin_list:
cache_tool = getToolByName(document.getPortalObject(), 'portal_caches')
if cache_tool is not None:
cache_tool.activate().updateCache()
cache_tool.activate(activity='SQLDict').updateCache()
selection_tool = document.getPortalObject().portal_selections
if selection_tool.getStorage() == document.getRelativeUrl():
selection_tool.activate().clearCachedContainer()
selection_tool.activate(activity='SQLDict').clearCachedContainer()
if selection_tool.getAnonymousStorage() == document.getRelativeUrl():
selection_tool.activate().clearCachedContainer(is_anonymous=True)
selection_tool.activate(activity='SQLDict').clearCachedContainer(is_anonymous=True)
sci['object'].activate().Preference_disableOtherPreferences()
sci['object'].activate(activity='SQLDict').Preference_disableOtherPreferences()
......@@ -410,7 +410,7 @@ class CopyContainer:
# changed, so that it updates related objects.
old_url = getattr(self, '_v_category_url_before_move', None)
if old_url is not None:
self.activate(after_method_id='unindexObject').updateRelatedContent(
self.activate(activity='SQLDict', after_method_id='unindexObject').updateRelatedContent(
old_url,
self.getRelativeUrl())
elif op == 0:
......
......@@ -426,7 +426,7 @@ class OldTypesTool(OFSFolder):
parent.portal_categories._setObject(action_type.id, action_type)
for type_info in self.objectValues():
self._migratePortalType(types_tool, type_info)
types_tool.activate()._finalizeMigration()
types_tool.activate(activity='SQLDict')._finalizeMigration()
LOG('OldTypesTool', WARNING, "... portal_types converted.")
return types_tool
......
......@@ -345,14 +345,14 @@ class ZCatalog(Folder, Persistent, Implicit):
# Re-schedule the same action in case there are remaining rows in the
# table. This can happen if the database connector limits the number
# of rows in the result.
self.activate(priority=5).\
self.activate(activity='SQLDict', priority=5).\
playBackRecordedObjectList(sql_catalog_id=sql_catalog_id,
catalog=catalog)
else:
# If there is nothing to do, go to next step.
if catalog == 0:
# If we were replaying unindex actions, time to replay index actions.
self.activate(priority=5).\
self.activate(activity='SQLDict', priority=5).\
playBackRecordedObjectList(sql_catalog_id=sql_catalog_id,
catalog=1)
# If we were replaying index actions, there is nothing else to do.
......@@ -498,18 +498,18 @@ class ZCatalog(Folder, Persistent, Implicit):
additional_priority=base_priority)
# Once reindexing is finished, change the hot reindexing state so that
# new catalog changes are applied in both catalogs.
self.activate(after_tag=final_activity_tag,
self.activate(activity='SQLDict', after_tag=final_activity_tag,
priority=base_priority)._setHotReindexingState(HOT_REINDEXING_DOUBLE_INDEXING_STATE,
source_sql_catalog_id=source_sql_catalog_id,
destination_sql_catalog_id=destination_sql_catalog_id,
archive_path=archive_path)
# Once in double-indexing mode, planned reindex can be replayed.
self.activate(after_method_id='_setHotReindexingState',
self.activate(activity='SQLDict', after_method_id='_setHotReindexingState',
priority=base_priority).playBackRecordedObjectList(
sql_catalog_id=destination_sql_catalog_id)
# Once there is nothing to replay, databases are sync'ed, so the new
# catalog can become current.
self.activate(after_method_id=('playBackRecordedObjectList',
self.activate(activity='SQLDict', after_method_id=('playBackRecordedObjectList',
'InventoryModule_reindexMovementList'),
after_tag='InventoryModule_reindexMovementList',
priority=base_priority)._finishHotReindexing(
......
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