Commit 5e375564 authored by Vincent Pelletier's avatar Vincent Pelletier

Deprecate method with plural in name.

Update all known callers to use the new method.
parent 9ebccc8b
...@@ -77,6 +77,7 @@ if len(payment_uid_list):\n ...@@ -77,6 +77,7 @@ if len(payment_uid_list):\n
\n \n
inventory_module = context.getPortalObject().archive_inventory_module\n inventory_module = context.getPortalObject().archive_inventory_module\n
node_inventory_dict = {}\n node_inventory_dict = {}\n
activate_kw = {"tag": tag}\n
for inventory in node_inventory_list:\n for inventory in node_inventory_list:\n
# Do only one inventory per node\n # Do only one inventory per node\n
if not node_inventory_dict.has_key(inventory.node_relative_url):\n if not node_inventory_dict.has_key(inventory.node_relative_url):\n
...@@ -84,21 +85,21 @@ for inventory in node_inventory_list:\n ...@@ -84,21 +85,21 @@ for inventory in node_inventory_list:\n
inv = inventory_module.newContent(portal_type="Archive Inventory",\n inv = inventory_module.newContent(portal_type="Archive Inventory",\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
start_date = date,\n start_date = date,\n
activate_kw = {"tag" : tag},\n activate_kw = activate_kw,\n
reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n
node_inventory_dict[inventory.node_relative_url] = inv\n node_inventory_dict[inventory.node_relative_url] = inv\n
else:\n else:\n
inv = node_inventory_dict[inventory.node_relative_url]\n inv = node_inventory_dict[inventory.node_relative_url]\n
\n \n
inv.setDefaultActivateParameters(tag=tag)\n inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
# Create one line per resource\n # Create one line per resource\n
inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n
resource=inventory.resource_relative_url,\n resource=inventory.resource_relative_url,\n
destination_section=inventory.section_relative_url,\n destination_section=inventory.section_relative_url,\n
activate_kw = {"tag" : tag},\n activate_kw = activate_kw,\n
reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n
inv_line.setDefaultActivateParameters(tag=tag)\n inv_line.setDefaultActivateParameterDict(activate_kw)\n
inv_line.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv_line.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
# This is a hack so that price is now and not at reindexing part\n # This is a hack so that price is now and not at reindexing part\n
inv_line.getPrice()\n inv_line.getPrice()\n
...@@ -118,7 +119,7 @@ for inventory in node_inventory_list:\n ...@@ -118,7 +119,7 @@ for inventory in node_inventory_list:\n
inv_line.setVariationCategoryList(variation_category_list)\n inv_line.setVariationCategoryList(variation_category_list)\n
context.log("construct cell", "base %s, %s" %(base_category_list,variation_category_list))\n context.log("construct cell", "base %s, %s" %(base_category_list,variation_category_list))\n
base_id = "movement"\n base_id = "movement"\n
line_kwd = {\'base_id\':base_id, "activate_kw":{"tag":tag}}\n line_kwd = {\'base_id\':base_id, "activate_kw": activate_kw}\n
inv_line.updateCellRange(script_id=\'CashDetail_asCellRange\', base_id=base_id)\n inv_line.updateCellRange(script_id=\'CashDetail_asCellRange\', base_id=base_id)\n
# create cell\n # create cell\n
cell_range_key_list = inv_line.getCellRangeKeyList(base_id=base_id)\n cell_range_key_list = inv_line.getCellRangeKeyList(base_id=base_id)\n
...@@ -126,7 +127,7 @@ for inventory in node_inventory_list:\n ...@@ -126,7 +127,7 @@ for inventory in node_inventory_list:\n
for k in cell_range_key_list:\n for k in cell_range_key_list:\n
category_list = filter(lambda k_item: k_item is not None, k)\n category_list = filter(lambda k_item: k_item is not None, k)\n
cell = inv_line.newCell(*k, **line_kwd)\n cell = inv_line.newCell(*k, **line_kwd)\n
cell.setDefaultActivateParameters(tag=tag)\n cell.setDefaultActivateParameterDict(activate_kw)\n
cell.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n cell.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
\n \n
mapped_value_list = [\'price\', \'quantity\']\n mapped_value_list = [\'price\', \'quantity\']\n
...@@ -141,7 +142,7 @@ for inventory in node_inventory_list:\n ...@@ -141,7 +142,7 @@ for inventory in node_inventory_list:\n
\n \n
# deliver all inventory\n # deliver all inventory\n
for inv in node_inventory_dict.values(): \n for inv in node_inventory_dict.values(): \n
inv.setDefaultActivateParameters(tag=tag)\n inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
inv.deliver()\n inv.deliver()\n
\n \n
...@@ -158,21 +159,21 @@ for inventory in payment_inventory_list:\n ...@@ -158,21 +159,21 @@ for inventory in payment_inventory_list:\n
destination=inventory.node_relative_url,\n destination=inventory.node_relative_url,\n
destination_payment_uid=inventory.payment_uid,\n destination_payment_uid=inventory.payment_uid,\n
start_date = date,\n start_date = date,\n
activate_kw = {"tag" : tag},\n activate_kw = activate_kw,\n
reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n
payment_inventory_dict[inventory.payment_uid] = inv\n payment_inventory_dict[inventory.payment_uid] = inv\n
else:\n else:\n
inv = payment_inventory_dict[inventory.payment_uid]\n inv = payment_inventory_dict[inventory.payment_uid]\n
\n \n
inv.setDefaultActivateParameters(tag=tag)\n inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
# Create one line per resource\n # Create one line per resource\n
inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n
resource=inventory.resource_relative_url,\n resource=inventory.resource_relative_url,\n
destination_section=inventory.section_relative_url,\n destination_section=inventory.section_relative_url,\n
activate_kw = {"tag" : tag},\n activate_kw = activate_kw,\n
reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n reindex_kw = {"sql_catalog_id" : destination_sql_catalog_id})\n
inv_line.setDefaultActivateParameters(tag=tag)\n inv_line.setDefaultActivateParameterDict(activate_kw)\n
inv_line.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv_line.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
inv_line.edit(quantity=inventory.total_quantity)\n inv_line.edit(quantity=inventory.total_quantity)\n
# This is a hack so that price is now and not at reindexing part\n # This is a hack so that price is now and not at reindexing part\n
...@@ -181,7 +182,7 @@ for inventory in payment_inventory_list:\n ...@@ -181,7 +182,7 @@ for inventory in payment_inventory_list:\n
\n \n
# deliver all inventory\n # deliver all inventory\n
for inv in payment_inventory_dict.values(): \n for inv in payment_inventory_dict.values(): \n
inv.setDefaultActivateParameters(tag=tag)\n inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
inv.deliver()\n inv.deliver()\n
......
...@@ -69,7 +69,7 @@ activity_tag = \'%s_CounterDay\' % (site_uid, )\n ...@@ -69,7 +69,7 @@ activity_tag = \'%s_CounterDay\' % (site_uid, )\n
if context.getPortalObject().portal_activities.countMessageWithTag(activity_tag) != 0:\n if context.getPortalObject().portal_activities.countMessageWithTag(activity_tag) != 0:\n
msg = Message(domain=\'ui\',message="Sorry, there is a pending counter date opening, please retry later")\n msg = Message(domain=\'ui\',message="Sorry, there is a pending counter date opening, please retry later")\n
raise ValidationFailed (msg,)\n raise ValidationFailed (msg,)\n
counter_date.setDefaultActivateParameters(tag=activity_tag)\n counter_date.setDefaultActivateParameterDict({'tag': activity_tag})\n
counter_date_list = [x.getObject() for x in counter_date.portal_catalog(portal_type=\'Counter Date\',site_uid=site_uid,simulation_state=\'open\')]\n counter_date_list = [x.getObject() for x in counter_date.portal_catalog(portal_type=\'Counter Date\',site_uid=site_uid,simulation_state=\'open\')]\n
for other_counter in counter_date_list:\n for other_counter in counter_date_list:\n
if other_counter.getUid()!=counter_date.getUid():\n if other_counter.getUid()!=counter_date.getUid():\n
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
return\n return\n
\n \n
for payment_transaction_line in context.getAggregateRelatedValueList():\n for payment_transaction_line in context.getAggregateRelatedValueList():\n
payment_transaction_line.setDefaultActivateParameters(tag=tag)\n payment_transaction_line.setDefaultActivateParameterDict({"tag": tag})\n
payment_transaction_line.setAggregate(None)\n payment_transaction_line.setAggregate(None)\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>context.setDefaultActivateParameters(activate_kw=activate_kw)\n <value> <string>context.setDefaultActivateParameterDict({"activate_kw": activate_kw})\n
context.setAggregate(aggregate)\n context.setAggregate(aggregate)\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -154,7 +154,7 @@ class ActiveObject(ExtensionClass.Base): ...@@ -154,7 +154,7 @@ class ActiveObject(ExtensionClass.Base):
if path: if path:
return self.unrestrictedTraverse(path) return self.unrestrictedTraverse(path)
def setDefaultActivateParameters(self, placeless=False, **kw): def setDefaultActivateParameteDict(self, parameter_dict, placeless=False):
# This method sets the default keyword parameters to activate. This is # This method sets the default keyword parameters to activate. This is
# useful when you need to specify special parameters implicitly (e.g. to # useful when you need to specify special parameters implicitly (e.g. to
# reindexObject). # reindexObject).
...@@ -163,7 +163,12 @@ class ActiveObject(ExtensionClass.Base): ...@@ -163,7 +163,12 @@ class ActiveObject(ExtensionClass.Base):
key = (_DEFAULT_ACTIVATE_PARAMETER_KEY, ) key = (_DEFAULT_ACTIVATE_PARAMETER_KEY, )
else: else:
key = (_DEFAULT_ACTIVATE_PARAMETER_KEY, id(aq_base(self))) key = (_DEFAULT_ACTIVATE_PARAMETER_KEY, id(aq_base(self)))
tv[key] = kw tv[key] = parameter_dict.copy()
def setDefaultActivateParameters(self, placeless=False, **kw):
warnings.warn('setDefaultActivateParameters is deprecated in favour of '
'setDefaultActivateParameteDict.', DeprecationWarning)
self.setDefaultActivateParameteDict(kw, placeless=placeless)
def getDefaultActivateParameterDict(self, inherit_placeless=True): def getDefaultActivateParameterDict(self, inherit_placeless=True):
# This method returns default activate parameters to self. # This method returns default activate parameters to self.
......
...@@ -44,7 +44,7 @@ def addActiveProcess(self, id, title='', REQUEST=None, activate_kw=None, **kw): ...@@ -44,7 +44,7 @@ def addActiveProcess(self, id, title='', REQUEST=None, activate_kw=None, **kw):
""" """
o = ActiveProcess(id) o = ActiveProcess(id)
if activate_kw is not None: if activate_kw is not None:
o.__of__(self).setDefaultActivateParameters(**activate_kw) o.__of__(self).setDefaultActivateParameterDict(activate_kw)
o.uid = self.portal_catalog.newUid() o.uid = self.portal_catalog.newUid()
self._setObject(id, o) self._setObject(id, o)
o = self._getOb(id) o = self._getOb(id)
......
...@@ -526,7 +526,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): ...@@ -526,7 +526,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self.tic() self.tic()
self.assertEquals(o.getTitle(), 'b') self.assertEquals(o.getTitle(), 'b')
o.setDefaultActivateParameters(tag = 'toto') o.setDefaultActivateParameterDict({'tag': 'toto'})
def titi(self): def titi(self):
self.setCorporateName(self.getTitle() + 'd') self.setCorporateName(self.getTitle() + 'd')
o.__class__.titi = titi o.__class__.titi = titi
......
...@@ -70,8 +70,7 @@ class AcceptSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -70,8 +70,7 @@ class AcceptSolver(SolverMixin, ConfigurableMixin, XMLObject):
solved_property_list = portal_type.getTestedPropertyList() solved_property_list = portal_type.getTestedPropertyList()
for simulation_movement in self.getDeliveryValueList(): for simulation_movement in self.getDeliveryValueList():
if activate_kw is not None: if activate_kw is not None:
simulation_movement.setDefaultActivateParameters( simulation_movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
movement = simulation_movement.getDeliveryValue() movement = simulation_movement.getDeliveryValue()
value_dict = {} value_dict = {}
base_category_set = set(movement.getBaseCategoryList()) base_category_set = set(movement.getBaseCategoryList())
......
...@@ -74,8 +74,7 @@ class AdoptSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -74,8 +74,7 @@ class AdoptSolver(SolverMixin, ConfigurableMixin, XMLObject):
[]).append(simulation_movement) []).append(simulation_movement)
for movement, simulation_movement_list in delivery_dict.iteritems(): for movement, simulation_movement_list in delivery_dict.iteritems():
if activate_kw is not None: if activate_kw is not None:
movement.setDefaultActivateParameters( movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
for solved_property in solved_property_list: for solved_property in solved_property_list:
# XXX hardcoded # XXX hardcoded
if solved_property == 'quantity': if solved_property == 'quantity':
......
...@@ -139,8 +139,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -139,8 +139,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
new_movement.setQuantity(total_quantity) new_movement.setQuantity(total_quantity)
if activate_kw is not None: if activate_kw is not None:
new_movement.setDefaultActivateParameters( new_movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
start_date = configuration_dict.get('start_date', None) start_date = configuration_dict.get('start_date', None)
if start_date is not None: if start_date is not None:
new_movement.recordProperty('start_date') new_movement.recordProperty('start_date')
......
...@@ -98,8 +98,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -98,8 +98,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
'quantity':split_quantity}) 'quantity':split_quantity})
new_movement = applied_rule.newContent(activate_kw=activate_kw, **kw) new_movement = applied_rule.newContent(activate_kw=activate_kw, **kw)
if activate_kw is not None: if activate_kw is not None:
new_movement.setDefaultActivateParameters( new_movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
start_date = configuration_dict.get('start_date', None) start_date = configuration_dict.get('start_date', None)
if start_date is not None: if start_date is not None:
new_movement.recordProperty('start_date') new_movement.recordProperty('start_date')
......
...@@ -99,8 +99,7 @@ class TradeModelSolver(AcceptSolver): ...@@ -99,8 +99,7 @@ class TradeModelSolver(AcceptSolver):
continue continue
for simulation_movement in simulation_movement_list: for simulation_movement in simulation_movement_list:
if activate_kw is not None: if activate_kw is not None:
simulation_movement.setDefaultActivateParameters( simulation_movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
value_dict = {} value_dict = {}
for solved_property in solved_property_list: for solved_property in solved_property_list:
new_value = movement.getProperty(solved_property) new_value = movement.getProperty(solved_property)
...@@ -119,8 +118,7 @@ class TradeModelSolver(AcceptSolver): ...@@ -119,8 +118,7 @@ class TradeModelSolver(AcceptSolver):
# XXX non-linear case is not yet supported. # XXX non-linear case is not yet supported.
for movement in trade_model_related_movement_list: for movement in trade_model_related_movement_list:
if activate_kw is not None: if activate_kw is not None:
movement.setDefaultActivateParameters( movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
for solved_property in solved_property_list: for solved_property in solved_property_list:
if solved_property == 'quantity': if solved_property == 'quantity':
simulation_movement_list = movement.getDeliveryRelatedValueList() simulation_movement_list = movement.getDeliveryRelatedValueList()
......
...@@ -114,14 +114,12 @@ class UnifySolver(AcceptSolver): ...@@ -114,14 +114,12 @@ class UnifySolver(AcceptSolver):
solved_property, solved_property,
)) ))
if activate_kw is not None: if activate_kw is not None:
movement.setDefaultActivateParameters( movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
new_value = configuration_dict.get('value') new_value = configuration_dict.get('value')
movement.setProperty(solved_property, new_value) movement.setProperty(solved_property, new_value)
for simulation_movement in simulation_movement_set: for simulation_movement in simulation_movement_set:
if activate_kw is not None: if activate_kw is not None:
simulation_movement.setDefaultActivateParameters( simulation_movement.setDefaultActivateParameterDict(activate_kw)
activate_kw=activate_kw, **activate_kw)
value_dict = {solved_property:new_value} value_dict = {solved_property:new_value}
for property_id, value in value_dict.iteritems(): for property_id, value in value_dict.iteritems():
if not simulation_movement.isPropertyRecorded(property_id): if not simulation_movement.isPropertyRecorded(property_id):
......
...@@ -92,7 +92,7 @@ class SplitAndDefer(CopyToTarget): ...@@ -92,7 +92,7 @@ class SplitAndDefer(CopyToTarget):
new_movement.activate(**self.additional_parameters).expand() new_movement.activate(**self.additional_parameters).expand()
# adopt new quantity on original simulation movement # adopt new quantity on original simulation movement
simulation_movement.edit(quantity=new_movement_quantity) simulation_movement.edit(quantity=new_movement_quantity)
simulation_movement.setDefaultActivateParameters(**self.activate_kw) simulation_movement.setDefaultActivateParameterDict(self.activate_kw)
simulation_movement.activate(**self.additional_parameters).expand() simulation_movement.activate(**self.additional_parameters).expand()
# SplitAndDefer solves the divergence at the current level, no need to # SplitAndDefer solves the divergence at the current level, no need to
......
...@@ -71,7 +71,7 @@ class SplitQuantity(CopyToTarget): ...@@ -71,7 +71,7 @@ class SplitQuantity(CopyToTarget):
new_movement.recordProperty('stop_date') new_movement.recordProperty('stop_date')
new_movement.edit(start_date=self.start_date, new_movement.edit(start_date=self.start_date,
stop_date=self.stop_date) stop_date=self.stop_date)
simulation_movement.setDefaultActivateParameters(**self.activate_kw) simulation_movement.setDefaultActivateParameterDict(self.activate_kw)
simulation_movement.edit ( simulation_movement.edit (
quantity = (simulation_movement.getQuantity() - self.quantity) quantity = (simulation_movement.getQuantity() - self.quantity)
* simulation_movement.getDeliveryRatio() * simulation_movement.getDeliveryRatio()
......
...@@ -56,7 +56,7 @@ method = getattr(context, method)\n ...@@ -56,7 +56,7 @@ method = getattr(context, method)\n
for id in id_list:\n for id in id_list:\n
ob = folder.get(id)\n ob = folder.get(id)\n
new_id = method(ob)\n new_id = method(ob)\n
ob.setDefaultActivateParameters(**activate_kw)\n ob.setDefaultActivateParameterDict(activate_kw)\n
ob.setId(new_id)\n ob.setId(new_id)\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -143,7 +143,7 @@ class CopyContainer: ...@@ -143,7 +143,7 @@ class CopyContainer:
activate_kw["after_tag"] = str(uid) activate_kw["after_tag"] = str(uid)
except TypeError: except TypeError:
activate_kw = {"after_tag":str(uid),} activate_kw = {"after_tag":str(uid),}
obj.setDefaultActivateParameters(**activate_kw) obj.setDefaultActivateParameterDict(activate_kw)
for sub_obj in obj.objectValues(): for sub_obj in obj.objectValues():
self._recursiveSetActivityAfterTag(sub_obj, activate_kw) self._recursiveSetActivityAfterTag(sub_obj, activate_kw)
......
...@@ -381,9 +381,9 @@ class ERP5TypeInformation(XMLObject, ...@@ -381,9 +381,9 @@ class ERP5TypeInformation(XMLObject,
ob.manage_setLocalRoles(user_id, ['Owner']) ob.manage_setLocalRoles(user_id, ['Owner'])
else: else:
if activate_kw is not None: if activate_kw is not None:
ob.setDefaultActivateParameters(**activate_kw) ob.setDefaultActivateParameterDict(activate_kw)
if reindex_kw is not None: if reindex_kw is not None:
ob.setDefaultReindexParameters(**reindex_kw) ob.setDefaultReindexParameterDict(reindex_kw)
if is_indexable is not None: if is_indexable is not None:
base_ob.isIndexable = is_indexable base_ob.isIndexable = is_indexable
container._setObject(id, base_ob) container._setObject(id, base_ob)
......
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