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
\n
inventory_module = context.getPortalObject().archive_inventory_module\n
node_inventory_dict = {}\n
activate_kw = {"tag": tag}\n
for inventory in node_inventory_list:\n
# Do only one inventory per node\n
if not node_inventory_dict.has_key(inventory.node_relative_url):\n
......@@ -84,21 +85,21 @@ for inventory in node_inventory_list:\n
inv = inventory_module.newContent(portal_type="Archive Inventory",\n
destination=inventory.node_relative_url,\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
node_inventory_dict[inventory.node_relative_url] = inv\n
else:\n
inv = node_inventory_dict[inventory.node_relative_url]\n
\n
inv.setDefaultActivateParameters(tag=tag)\n
inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
# Create one line per resource\n
inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n
resource=inventory.resource_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
inv_line.setDefaultActivateParameters(tag=tag)\n
inv_line.setDefaultActivateParameterDict(activate_kw)\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
inv_line.getPrice()\n
......@@ -118,7 +119,7 @@ for inventory in node_inventory_list:\n
inv_line.setVariationCategoryList(variation_category_list)\n
context.log("construct cell", "base %s, %s" %(base_category_list,variation_category_list))\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
# create cell\n
cell_range_key_list = inv_line.getCellRangeKeyList(base_id=base_id)\n
......@@ -126,7 +127,7 @@ for inventory in node_inventory_list:\n
for k in cell_range_key_list:\n
category_list = filter(lambda k_item: k_item is not None, k)\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
\n
mapped_value_list = [\'price\', \'quantity\']\n
......@@ -141,7 +142,7 @@ for inventory in node_inventory_list:\n
\n
# deliver all inventory\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.deliver()\n
\n
......@@ -158,21 +159,21 @@ for inventory in payment_inventory_list:\n
destination=inventory.node_relative_url,\n
destination_payment_uid=inventory.payment_uid,\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
payment_inventory_dict[inventory.payment_uid] = inv\n
else:\n
inv = payment_inventory_dict[inventory.payment_uid]\n
\n
inv.setDefaultActivateParameters(tag=tag)\n
inv.setDefaultActivateParameterDict(activate_kw)\n
inv.setDefaultReindexParameters(sql_catalog_id=destination_sql_catalog_id)\n
# Create one line per resource\n
inv_line = inv.newContent(portal_type = "Archive Inventory Line",\n
resource=inventory.resource_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
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.edit(quantity=inventory.total_quantity)\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
\n
# deliver all inventory\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.deliver()\n
......
......@@ -69,7 +69,7 @@ activity_tag = \'%s_CounterDay\' % (site_uid, )\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
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
for other_counter in counter_date_list:\n
if other_counter.getUid()!=counter_date.getUid():\n
......
......@@ -54,7 +54,7 @@
return\n
\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
</string> </value>
</item>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<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
</string> </value>
</item>
......
......@@ -154,7 +154,7 @@ class ActiveObject(ExtensionClass.Base):
if 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
# useful when you need to specify special parameters implicitly (e.g. to
# reindexObject).
......@@ -163,7 +163,12 @@ class ActiveObject(ExtensionClass.Base):
key = (_DEFAULT_ACTIVATE_PARAMETER_KEY, )
else:
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):
# This method returns default activate parameters to self.
......
......@@ -44,7 +44,7 @@ def addActiveProcess(self, id, title='', REQUEST=None, activate_kw=None, **kw):
"""
o = ActiveProcess(id)
if activate_kw is not None:
o.__of__(self).setDefaultActivateParameters(**activate_kw)
o.__of__(self).setDefaultActivateParameterDict(activate_kw)
o.uid = self.portal_catalog.newUid()
self._setObject(id, o)
o = self._getOb(id)
......
......@@ -526,7 +526,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self.tic()
self.assertEquals(o.getTitle(), 'b')
o.setDefaultActivateParameters(tag = 'toto')
o.setDefaultActivateParameterDict({'tag': 'toto'})
def titi(self):
self.setCorporateName(self.getTitle() + 'd')
o.__class__.titi = titi
......
......@@ -70,8 +70,7 @@ class AcceptSolver(SolverMixin, ConfigurableMixin, XMLObject):
solved_property_list = portal_type.getTestedPropertyList()
for simulation_movement in self.getDeliveryValueList():
if activate_kw is not None:
simulation_movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
simulation_movement.setDefaultActivateParameterDict(activate_kw)
movement = simulation_movement.getDeliveryValue()
value_dict = {}
base_category_set = set(movement.getBaseCategoryList())
......
......@@ -74,8 +74,7 @@ class AdoptSolver(SolverMixin, ConfigurableMixin, XMLObject):
[]).append(simulation_movement)
for movement, simulation_movement_list in delivery_dict.iteritems():
if activate_kw is not None:
movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
movement.setDefaultActivateParameterDict(activate_kw)
for solved_property in solved_property_list:
# XXX hardcoded
if solved_property == 'quantity':
......
......@@ -139,8 +139,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
new_movement.setQuantity(total_quantity)
if activate_kw is not None:
new_movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
new_movement.setDefaultActivateParameterDict(activate_kw)
start_date = configuration_dict.get('start_date', None)
if start_date is not None:
new_movement.recordProperty('start_date')
......
......@@ -98,8 +98,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
'quantity':split_quantity})
new_movement = applied_rule.newContent(activate_kw=activate_kw, **kw)
if activate_kw is not None:
new_movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
new_movement.setDefaultActivateParameterDict(activate_kw)
start_date = configuration_dict.get('start_date', None)
if start_date is not None:
new_movement.recordProperty('start_date')
......
......@@ -99,8 +99,7 @@ class TradeModelSolver(AcceptSolver):
continue
for simulation_movement in simulation_movement_list:
if activate_kw is not None:
simulation_movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
simulation_movement.setDefaultActivateParameterDict(activate_kw)
value_dict = {}
for solved_property in solved_property_list:
new_value = movement.getProperty(solved_property)
......@@ -119,8 +118,7 @@ class TradeModelSolver(AcceptSolver):
# XXX non-linear case is not yet supported.
for movement in trade_model_related_movement_list:
if activate_kw is not None:
movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
movement.setDefaultActivateParameterDict(activate_kw)
for solved_property in solved_property_list:
if solved_property == 'quantity':
simulation_movement_list = movement.getDeliveryRelatedValueList()
......
......@@ -114,14 +114,12 @@ class UnifySolver(AcceptSolver):
solved_property,
))
if activate_kw is not None:
movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
movement.setDefaultActivateParameterDict(activate_kw)
new_value = configuration_dict.get('value')
movement.setProperty(solved_property, new_value)
for simulation_movement in simulation_movement_set:
if activate_kw is not None:
simulation_movement.setDefaultActivateParameters(
activate_kw=activate_kw, **activate_kw)
simulation_movement.setDefaultActivateParameterDict(activate_kw)
value_dict = {solved_property:new_value}
for property_id, value in value_dict.iteritems():
if not simulation_movement.isPropertyRecorded(property_id):
......
......@@ -92,7 +92,7 @@ class SplitAndDefer(CopyToTarget):
new_movement.activate(**self.additional_parameters).expand()
# adopt new quantity on original simulation movement
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()
# SplitAndDefer solves the divergence at the current level, no need to
......
......@@ -71,7 +71,7 @@ class SplitQuantity(CopyToTarget):
new_movement.recordProperty('stop_date')
new_movement.edit(start_date=self.start_date,
stop_date=self.stop_date)
simulation_movement.setDefaultActivateParameters(**self.activate_kw)
simulation_movement.setDefaultActivateParameterDict(self.activate_kw)
simulation_movement.edit (
quantity = (simulation_movement.getQuantity() - self.quantity)
* simulation_movement.getDeliveryRatio()
......
......@@ -56,7 +56,7 @@ method = getattr(context, method)\n
for id in id_list:\n
ob = folder.get(id)\n
new_id = method(ob)\n
ob.setDefaultActivateParameters(**activate_kw)\n
ob.setDefaultActivateParameterDict(activate_kw)\n
ob.setId(new_id)\n
</string> </value>
</item>
......
......@@ -143,7 +143,7 @@ class CopyContainer:
activate_kw["after_tag"] = str(uid)
except TypeError:
activate_kw = {"after_tag":str(uid),}
obj.setDefaultActivateParameters(**activate_kw)
obj.setDefaultActivateParameterDict(activate_kw)
for sub_obj in obj.objectValues():
self._recursiveSetActivityAfterTag(sub_obj, activate_kw)
......
......@@ -381,9 +381,9 @@ class ERP5TypeInformation(XMLObject,
ob.manage_setLocalRoles(user_id, ['Owner'])
else:
if activate_kw is not None:
ob.setDefaultActivateParameters(**activate_kw)
ob.setDefaultActivateParameterDict(activate_kw)
if reindex_kw is not None:
ob.setDefaultReindexParameters(**reindex_kw)
ob.setDefaultReindexParameterDict(reindex_kw)
if is_indexable is not None:
base_ob.isIndexable = is_indexable
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