Commit 1bcda4e7 authored by Julien Muchembled's avatar Julien Muchembled

style: dict() -> {} (or better)

parent 23d7bdd2
......@@ -678,7 +678,7 @@ for key, data in line_per_account.items():\n
final_balance_if_credit=max(-closing_balance, 0) or 0,)\n
\n
sort_key = (node_string_index, node_title, mirror_section_title)\n
analytic_dict = dict()\n
analytic_dict = {}\n
for analytic, uid in zip(group_analytic, analytic_key_list):\n
title = getAnalyticTitleFromUid(uid)\n
analytic_dict[analytic] = title\n
......@@ -727,7 +727,7 @@ def getAccountClass(account_relative_url):\n
return None # this account has no class on the current GAP \n
\n
new_line_list = []\n
account_per_class = dict()\n
account_per_class = {}\n
for brain in line_list:\n
account_per_class.setdefault(\n
getAccountClass(brain.node_relative_url), []).append(brain)\n
......
......@@ -59,11 +59,11 @@ request = portal.REQUEST\n
# cache the title in the request, it will be used by Movement_getProjectTitle\n
# and Movement_getFunctionTitle scripts\n
request.other[\'Movement_getProjectTitle.project_title_dict\'\n
] = project_title_dict = dict()\n
] = project_title_dict = {}\n
request.other[\'Movement_getFunctionTitle.function_title_dict\'\n
] = function_title_dict = dict()\n
] = function_title_dict = {}\n
request.other[\'Movement_getFundingTitle.funding_title_dict\'\n
] = funding_title_dict = dict()\n
] = funding_title_dict = {}\n
\n
analytic_column_list = ()\n
funding_item_list = context.AccountingTransactionLine_getFundingItemList()\n
......
......@@ -241,7 +241,7 @@ if mirror_section_category_list:\n
\n
report_section_list = []\n
\n
existing_section_dict = dict()\n
existing_section_dict = {}\n
\n
# group by node\n
# movements in the period\n
......
......@@ -150,7 +150,7 @@ for brain in portal.Base_zGetNotGroupedMovementList(\n
Movement_getExplanationTitle=\n
mvt.hasTitle() and mvt.getTitle() or transaction.getTitle())\n
\n
analytic_info = dict()\n
analytic_info = {}\n
for analytic_column, analytic_column_title in analytic_column_list:\n
if analytic_column == \'project\':\n
if is_source:\n
......
......@@ -58,7 +58,7 @@
portal = context.getPortalObject()\n
Base_translateString = portal.Base_translateString\n
\n
precision_cache = dict()\n
precision_cache = {}\n
def roundCurrency(value, resource_relative_url):\n
if resource_relative_url not in precision_cache:\n
qty_precision = portal.restrictedTraverse(\n
......
......@@ -105,7 +105,7 @@ else:\n
params=params)\n
\n
\n
account_reference_cache = dict()\n
account_reference_cache = {}\n
def getAccountReference(node):\n
try:\n
return account_reference_cache[node]\n
......@@ -122,7 +122,7 @@ def getTitle(document):\n
return document.getTranslatedTitle()\n
return \'\'\n
\n
bank_account_title_cache = dict()\n
bank_account_title_cache = {}\n
def getBankAccountTitle(bank_account):\n
try:\n
return bank_account_title_cache[bank_account]\n
......@@ -141,7 +141,7 @@ def getBankAccountTitle(bank_account):\n
bank_account_title_cache[bank_account] = value\n
return value\n
\n
accounting_currency_reference_cache = dict()\n
accounting_currency_reference_cache = {}\n
def getAccountingCurrencyReference(section_relative_url):\n
try:\n
return accounting_currency_reference_cache[section_relative_url]\n
......@@ -157,7 +157,7 @@ def getAccountingCurrencyReference(section_relative_url):\n
\n
portal_type = context.getPortalAccountingMovementTypeList()\n
\n
displayed_delivery_dict = dict()\n
displayed_delivery_dict = {}\n
for delivery in delivery_list:\n
if delivery.uid in displayed_delivery_dict: continue\n
displayed_delivery_dict[delivery.uid] = True\n
......
......@@ -146,7 +146,7 @@ if creation_date_range_min or creation_date_range_max:\n
if stat:\n
return context.countFolder(**params)\n
\n
select_dict = params.get(\'select_dict\') or dict()\n
select_dict = params.get(\'select_dict\') or {}\n
select_dict.update(dict(total_debit=None,\n
total_credit=None,\n
reference=None,\n
......
......@@ -71,7 +71,7 @@ grouping_query = ComplexQuery(\n
Query(grouping_date=at_date, range="min"),\n
operator="OR")\n
\n
account_number_memo = dict()\n
account_number_memo = {}\n
def getAccountNumber(account_url):\n
try:\n
return account_number_memo[account_url]\n
......@@ -80,7 +80,7 @@ def getAccountNumber(account_url):\n
portal.restrictedTraverse(account_url).Account_getGapId()\n
return account_number_memo[account_url]\n
\n
section_title_memo = dict()\n
section_title_memo = {}\n
def getSectionTitle(uid):\n
try:\n
return section_title_memo[uid]\n
......
......@@ -57,7 +57,7 @@ portal = context.getPortalObject()\n
\n
line_list = []\n
\n
extra_kw = dict()\n
extra_kw = {}\n
if payment:\n
extra_kw[\'payment\'] = payment\n
\n
......@@ -71,7 +71,7 @@ if project_uid:\n
else:\n
extra_kw[\'project_uid\'] = project_uid\n
\n
account_title_cache = dict()\n
account_title_cache = {}\n
def getAccountId(node_relative_url):\n
if node_relative_url not in account_title_cache:\n
title = portal.restrictedTraverse(node_relative_url).Account_getGapId(gap_root=gap_root)\n
......@@ -80,7 +80,7 @@ def getAccountId(node_relative_url):\n
\n
\n
# FIXME: this can be passed as node category to getMovementHistoryList\n
account_in_gap_root_cache = dict()\n
account_in_gap_root_cache = {}\n
def isAccountInGapRoot(node_relative_url):\n
if node_relative_url not in account_in_gap_root_cache:\n
is_in = portal.restrictedTraverse(node_relative_url).isMemberOf(gap_root)\n
......@@ -88,7 +88,7 @@ def isAccountInGapRoot(node_relative_url):\n
return account_in_gap_root_cache[node_relative_url]\n
\n
\n
displayed_transaction = dict()\n
displayed_transaction = {}\n
total_credit = 0\n
total_debit = 0\n
\n
......@@ -159,7 +159,7 @@ for brain in portal.portal_simulation.getMovementHistoryList(\n
date=date,\n
debit=debit,\n
credit=credit,)\n
analytic_info = dict()\n
analytic_info = {}\n
for analytic_column, analytic_column_title in analytic_column_list:\n
if analytic_column == \'project\':\n
analytic_info[\'project\'] = brain.Movement_getProjectTitle()\n
......
......@@ -79,7 +79,7 @@ original transaction currency. If currencies on this invoice and the related\n
payments are not consistent, a ValueError is raised.\n
"""\n
portal = context.getPortalObject()\n
total_payable_price_per_node_section = dict()\n
total_payable_price_per_node_section = {}\n
\n
if simulation_state is None:\n
state_list = [x[1] for x in context.ERP5Site_getWorkflowStateItemList(\n
......
......@@ -54,7 +54,7 @@
function_uid = context.function_uid\n
\n
title_dict = container.REQUEST.get(\n
\'Movement_getFunctionTitle.function_title_dict\') or dict()\n
\'Movement_getFunctionTitle.function_title_dict\') or {}\n
if function_uid in title_dict:\n
return title_dict[function_uid]\n
\n
......
......@@ -54,7 +54,7 @@
funding_uid = context.funding_uid\n
\n
title_dict = container.REQUEST.get(\n
\'Movement_getFundingTitle.funding_title_dict\') or dict()\n
\'Movement_getFundingTitle.funding_title_dict\') or {}\n
if funding_uid in title_dict:\n
return title_dict[funding_uid]\n
\n
......
......@@ -53,7 +53,7 @@
<value> <string>project_uid = context.project_uid\n
\n
title_dict = container.REQUEST.get(\n
\'Movement_getProjectTitle.project_title_dict\') or dict()\n
\'Movement_getProjectTitle.project_title_dict\') or {}\n
if project_uid in title_dict:\n
return title_dict[project_uid]\n
\n
......
......@@ -218,7 +218,7 @@ loop_dict = dict(\n
\t\tsub_prefix = 1,\n
\t\tend_prefix = \'a\',\n
\t\tschedule_index = \'A\',\n
\t\tschedules = dict()\n
\t\tschedules = {}\n
\t\t)\n
\n
def do_section(item):\n
......
......@@ -111,11 +111,11 @@ stool.setSelectionFor(\'entity_transaction_selection\', None)\n
stool.setSelectionFor(\'account_module_selection\', None)\n
\n
# set sort order on accounting module\n
stool.setSelectionParamsFor(\'accounting_selection\', dict()) # (this recreates selection)\n
stool.setSelectionParamsFor(\'accounting_selection\', {}) # (this recreates selection)\n
stool.setSelectionSortOrder(\'accounting_selection\', sort_on=((\'operation_date\', \'ascending\'),))\n
\n
# set sort order and columns on account module\n
stool.setSelectionParamsFor(\'account_module_selection\', dict()) # (this recreates selection)\n
stool.setSelectionParamsFor(\'account_module_selection\', {}) # (this recreates selection)\n
stool.setSelectionSortOrder(\'account_module_selection\', sort_on=((\'preferred_gap_id\', \'ascending\'),))\n
stool.setSelectionColumns(\'account_module_selection\',\n
[(\'preferred_gap_id\', \'GAP Number\'),\n
......
......@@ -76,7 +76,7 @@ if REQUEST is not None:\n
from DateTime import DateTime\n
now = DateTime()\n
\n
existing_group_set = dict()\n
existing_group_set = {}\n
for assignment in context.contentValues(portal_type=\'Assignment\'):\n
if assignment.getGroup() \\\n
and assignment.getValidationState() == \'open\' \\\n
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>kw = dict()\n
<value> <string>kw = {}\n
budget = context.getParentValue().getParentValue()\n
budget_model = budget.getSpecialiseValue(portal_type=\'Budget Model\')\n
if budget_model is not None:\n
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>search_kw = dict()\n
<value> <string>search_kw = {}\n
portal = context.getPortalObject()\n
financial_section_list = context.getVariationCategoryList(base_category_list=(\'financial_section\'))\n
for financial_section in financial_section_list:\n
......
......@@ -57,7 +57,7 @@ except KeyError:\n
\n
dependant_dimensions_dict = context.BudgetLine_getSummaryDimensionKeyDict()\n
\n
summary_key_dict = dict()\n
summary_key_dict = {}\n
\n
from Products.ERP5Type.Utils import cartesianProduct\n
# also add all cell coordinates in the dictionnary\n
......
......@@ -62,7 +62,7 @@ coordinates.\n
"""\n
# look on the budget model to see which base categories are used for non strict\n
# membership. We will only update summaries for thoses axis\n
non_strict_base_category_set = dict()\n
non_strict_base_category_set = {}\n
budget_model = context.getParentValue().getSpecialiseValue()\n
if budget_model is not None:\n
for budget_variation in budget_model.contentValues(\n
......@@ -87,7 +87,7 @@ def reversed(seq):\n
return seq\n
\n
# build a dict of dependant dimensions\n
dependant_dimensions_dict = dict()\n
dependant_dimensions_dict = {}\n
for bc in non_strict_base_category_set.keys():\n
vcl = reversed(context.getVariationCategoryList(base_category_list=(bc,)))\n
for vc in vcl:\n
......
......@@ -60,8 +60,8 @@ split_depth = 1\n
# Build a dict of title to display, based on the titles of corresponding\n
# budget variations, and a dict of indexes for sorting.\n
# Also build a list of line level variations, for which we only choose one value.\n
base_category_title_dict = dict()\n
base_category_int_index_dict = dict()\n
base_category_title_dict = {}\n
base_category_int_index_dict = {}\n
budget_line = container.REQUEST.get(\'here\')\n
line_level_variation_list = []\n
if budget_line is not None:\n
......
......@@ -157,7 +157,7 @@ for budget in budget_list:\n
\n
# To get the count of lines correct (for the print range)\n
if target_currency_title:\n
line_list.append(dict())\n
line_list.append({})\n
\n
for budget_line in budget.contentValues(sort_on=((\'int_index\', \'asc\'),)):\n
total_level_1_initial_budget = 0\n
......
......@@ -60,7 +60,7 @@ person_value_list = portal.portal_categories.restrictedTraverse(\n
checked_permission=\'View\')\n
\n
# for stat\n
total_time_per_resource = dict()\n
total_time_per_resource = {}\n
total_time = 0\n
\n
result_list = []\n
......@@ -76,7 +76,7 @@ presence_resource_uid_list = [inventory.resource_uid for inventory\n
\n
\n
for person in person_value_list:\n
result_dict = dict()\n
result_dict = {}\n
person_total = 0\n
\n
person_planned_time = person.getAvailableTime(\n
......
......@@ -56,7 +56,7 @@ translateString = context.Base_translateString \n
context.Base_edit(form_id=\'Person_viewAsWeb\')\n
\n
context.ERP5Site_redirect(\'%s/account\' % context.getWebSiteValue().absolute_url(), \\\n
keep_items={\'portal_status_message\': translateString("Your personal informations are updated.", mapping = dict())})\n
keep_items={\'portal_status_message\': translateString("Your personal informations are updated.", mapping={})})\n
</string> </value>
</item>
<item>
......
......@@ -200,7 +200,7 @@ else:\n
portal_status_message = "Please select an item."\n
\n
context.Base_redirect(\'SaleOrder_viewAsWeb\', \\\n
keep_items={\'portal_status_message\': translateString(portal_status_message, mapping = dict())})\n
keep_items={\'portal_status_message\': translateString(portal_status_message, mapping={})})\n
</string> </value>
</item>
<item>
......
......@@ -54,7 +54,7 @@
\n
if (context.getPortalType() != \'Web Site\'):\n
context.Base_redirect(\'\', keep_items={\n
\'portal_status_message\': translateString("You can only launch this script on a web site.", mapping = dict())\n
\'portal_status_message\': translateString("You can only launch this script on a web site.", mapping={})\n
})\n
\n
# creation the default sections\n
......@@ -94,7 +94,7 @@ checkout_section.setProperty(\'ecommerce_default_content\', True)\n
checkout_section.setProperty(\'ecommerce_product_list\', False)\n
\n
context.Base_redirect(\'\', keep_items={\n
\'portal_status_message\': translateString("Your web site is now an ecommerce plateform.", mapping = dict())\n
\'portal_status_message\': translateString("Your web site is now an ecommerce plateform.", mapping={})\n
})\n
</string> </value>
</item>
......
......@@ -59,7 +59,7 @@
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
def getPortalTypeContentTranslationMapping():\n
result = dict()\n
result = {}\n
for type_information in context.getPortalObject().portal_types.listTypeInfo():\n
content_translation_domain_property_name_list =\\\n
type_information.getContentTranslationDomainPropertyNameList()\n
......
......@@ -52,7 +52,7 @@
<key> <string>_body</string> </key>
<value> <string>if context.getParentValue().portal_type == \'Credential Request\':\n
return {\'Address\':dict(organisation_default_address=\'Organisation Default Address\')}\n
return dict()\n
return {}\n
</string> </value>
</item>
<item>
......
......@@ -68,7 +68,7 @@ past_title=portal.Base_translateString("past")\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -68,7 +68,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -71,7 +71,7 @@ for ticket_type in ticket_type_list:\n
total_count=0\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -53,7 +53,7 @@
<value> <string>from Products.ERP5Form.Report import ReportSection\n
result=[]\n
request = context.REQUEST\n
params = dict()\n
params = {}\n
\n
selection_columns = [(\'validation_state\', \'State\')]\n
#Add dynamicaly ticket type columns to the form\n
......
......@@ -95,7 +95,7 @@ def createReturnLine(uid,list):\n
return len(list)-1\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -61,7 +61,7 @@ notification_message = portal.portal_notifications.getDocumentValue(\n
reference=reference)\n
\n
if substitution_method_parameter_dict is None:\n
substitution_method_parameter_dict=dict()\n
substitution_method_parameter_dict = {}\n
# Notification method will receive the current event under "event_value" key.\n
# This way notification method can return properties from recipient or follow up of the event.\n
substitution_method_parameter_dict.setdefault(\'event_value\', context)\n
......
......@@ -67,7 +67,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -65,7 +65,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -67,7 +67,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -65,7 +65,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -67,7 +67,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -66,7 +66,7 @@ past_state_list = portal.Event_getPastStateList()\n
line_list = []\n
\n
# Prepare the parameters to filter\n
query_dict = dict()\n
query_dict = {}\n
if request_start_date:\n
query_dict[\'delivery.start_date\'] = dict(range=\'min\', query=request_start_date)\n
if request_stop_date:\n
......
......@@ -59,7 +59,7 @@ if getattr(send_method, \'meta_type\', None) == \'Script (Python)\':\n
parameter_list = send_method.ZScriptHTML_tryParams()\n
\n
# Turn the SafeMapping from keyword arguments into a dict.\n
kwargs = dict()\n
kwargs = {}\n
for key in parameter_list:\n
state_change_arg = state_change[\'kwargs\'].get(key)\n
if state_change_arg:\n
......
......@@ -76,7 +76,7 @@ user_name = person_value.getReference()\n
\n
# save request parameters\n
# XXX we exclude some reserved names in a very ad hoc way\n
request_form = dict()\n
request_form = {}\n
for k, v in request.form.items():\n
if k not in (\'TraversalRequestNameStack\', \'AUTHENTICATED_USER\', \'URL\',\n
\'SERVER_URL\', \'AUTHENTICATION_PATH\', \'USER_PREF_LANGUAGES\', \'PARENTS\',\n
......@@ -98,7 +98,7 @@ if activity_context == portal:\n
activity_context = portal.portal_simulation\n
\n
\n
params = dict()\n
params = {}\n
form = getattr(context, deferred_style_dialog_method)\n
if hasattr(form, \'ZScriptHTML_tryParams\'):\n
# Some actions are wrapped by a script.\n
......
......@@ -76,7 +76,7 @@ skin_name = request[\'deferred_portal_skin\']\n
\n
# save request parameters (after calling the report_method which may tweak the\n
# request). XXX we exclude some reserved names in a very ad hoc way\n
request_other = dict()\n
request_other = {}\n
for k, v in request.items():\n
if k not in (\'TraversalRequestNameStack\', \'AUTHENTICATED_USER\', \'URL\',\n
\'SERVER_URL\', \'AUTHENTICATION_PATH\', \'USER_PREF_LANGUAGES\', \'PARENTS\',\n
......
......@@ -68,7 +68,7 @@ else:\n
raise ValueError, \'form meta_type (%r) unknown\' %(form.meta_type,)\n
\n
# Rebuild request_other as report section can have modify request content\n
request_other = dict()\n
request_other = {}\n
for k, v in request.items():\n
if k not in (\'TraversalRequestNameStack\', \'AUTHENTICATED_USER\', \'URL\',\n
\'SERVER_URL\', \'AUTHENTICATION_PATH\', \'USER_PREF_LANGUAGES\', \'PARENTS\',\n
......
......@@ -79,7 +79,7 @@ for line in listbox:\n
# selected_dict contains the list of selected fields that needs\n
# to change of template. The user can select or unselect any field\n
# in the preview_listbox\n
selected_dict = dict()\n
selected_dict = {}\n
if preview_listbox is not None:\n
for line in preview_listbox:\n
if line[\'selected\']:\n
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>prevision = dict()\n
<value> <string>prevision = {}\n
\n
if context.getDestinationAccount():\n
prevision[\'destination\'] = context.getDestinationAccount()\n
......
......@@ -60,7 +60,7 @@ total_quantity = 0.0\n
\n
item_portal_type = kw.get(\'type\')\n
\n
item_property_dict = dict()\n
item_property_dict = {}\n
\n
# if the formbox for extra item properties is enabled, use it.\n
dialog = getattr(context, dialog_id)\n
......
......@@ -69,7 +69,7 @@ for sub_object in sub_object_list:\n
if delete_id_list:\n
context.manage_delObjects(ids=delete_id_list)\n
\n
sub_object_by_model = dict()\n
sub_object_by_model = {}\n
for sub_object in sub_object_list:\n
sub_object_by_model.setdefault(\n
sub_object.getParentValue(), []).append(sub_object.getId())\n
......
......@@ -87,7 +87,7 @@ requirements_items.sort(key=lambda x: x[\'id\'])\n
\n
clean_requirements = {}\n
clean_requirements_key_list = [] # use a list for keys, to keep ordering\n
description_dict = dict()\n
description_dict = {}\n
has_1st_level_requirement = False\n
has_2nd_level_requirement = False\n
new_1st_level_requirement = None\n
......
......@@ -7,7 +7,7 @@ def parseTestReport(text):
parser.feed(text)
root = parser.close()
table = root.xpath('//table[@id="SELENIUM-TEST"]')[0]
report = dict()
report = {}
header = table[0][0]
report['status'] = header.attrib['class'].find('passed') > -1
report['name'] = header[0].text
......
......@@ -82,7 +82,7 @@ def URLGetter(section_title,\n
total_price=total_price,)\n
return getListItemUrl\n
\n
total = dict()\n
total = {}\n
\n
base_contribution_uid_dict = {}\n
for base_contribution in base_contribution_list:\n
......
......@@ -85,7 +85,7 @@ for a_line in a.searchFolder(portal_type=\'Test Result Line\'):\n
if title in b_title_dict:\n
# do some diffwork\n
b_line = b[b_title_dict[title]]\n
difference_dict = dict()\n
difference_dict = {}\n
for prop in compared_prop_list:\n
diff = b_line.getProperty(prop) - a_line.getProperty(prop)\n
if diff != 0:\n
......
......@@ -67,7 +67,7 @@ if a.getSimulationState() != "stopped" or b.getSimulationState() != "stopped":\n
compared_prop_list = (\'all_tests\', \'errors\', \'failures\', \'skips\')\n
\n
\n
d = dict()\n
d = {}\n
for prop in compared_prop_list:\n
d[prop] = b.getProperty(prop) - a.getProperty(prop)\n
\n
......
......@@ -76,9 +76,7 @@ test_suite = context.getPortalObject().test_suite_module.searchFolder(title=cont
xs = map(int, test_suite.getGraphCoordinate())\n
\n
\n
test_informations = dict()\n
test_informations.update({"test":tests, "xs":xs})\n
return json.dumps(test_informations)\n
return json.dumps({"test": tests, "xs": xs})\n
</string> </value>
</item>
<item>
......
......@@ -71,7 +71,7 @@ try:\n
finally:\n
context.getPortalObject().portal_selections.setSelectionParamsFor(module_selection_name, saved_selection_params)\n
\n
account_title_cache = dict()\n
account_title_cache = {}\n
def getAccountTitle(relative_url):\n
try:\n
return account_title_cache[relative_url]\n
......
......@@ -53,7 +53,7 @@
<value> <string>from Products.ERP5Type.Message import translateString\n
types_tool = context.getPortalObject().portal_types\n
movement_type_list = context.getPortalMovementTypeList()\n
type_set = dict()\n
type_set = {}\n
\n
for type_name in types_tool.getTypeInfo(context).getTypeAllowedContentTypeList():\n
for line_type_name in types_tool.getTypeInfo(type_name).getTypeAllowedContentTypeList():\n
......
......@@ -53,7 +53,7 @@
<value> <string>object = state_change[\'object\']\n
delivery = object.getExplanationValue()\n
\n
activate_kw = dict()\n
activate_kw = {}\n
if getattr(delivery, \'calculatePacking\', None) is not None:\n
try:\n
container = object.getContainerValue()\n
......
......@@ -54,7 +54,7 @@
from DateTime import DateTime\n
request = container.REQUEST\n
\n
preferences = dict()\n
preferences = {}\n
if not box_relative_url:\n
box_relative_url = request.get(\'box_relative_url\', None)\n
if box_relative_url:\n
......
......@@ -90,7 +90,7 @@ def resetSelection(selection_name):\n
selection_tool.setSelectionColumns(selection_name, [])\n
selection_tool.setSelectionStats(selection_name, [])\n
selection_tool.setListboxDisplayMode(context.REQUEST, \'FlatListMode\', selection_name)\n
selection_tool.setSelectionParamsFor(selection_name, dict())\n
selection_tool.setSelectionParamsFor(selection_name, {})\n
\n
resetSelection(\'foo_selection\')\n
resetSelection(\'foo_line_selection\')\n
......
......@@ -98,7 +98,7 @@ def resetSelection(selection_name):\n
selection_tool.setSelectionColumns(selection_name, [])\n
selection_tool.setSelectionStats(selection_name, [])\n
selection_tool.setListboxDisplayMode(context.REQUEST, \'FlatListMode\', selection_name)\n
selection_tool.setSelectionParamsFor(selection_name, dict())\n
selection_tool.setSelectionParamsFor(selection_name, {})\n
\n
resetSelection(\'foo_selection\')\n
resetSelection(\'foo_line_selection\')\n
......
......@@ -45,8 +45,8 @@ class AccountingTransactionBalance(Constraint):
"""Implement here the consistency checker
"""
error_list = []
source_sum = dict()
destination_sum = dict()
source_sum = {}
destination_sum = {}
for line in obj.getMovementList(
portal_type=obj.getPortalAccountingMovementTypeList()):
if line.getSourceValue() is not None:
......
......@@ -49,8 +49,8 @@ class AccountingTransactionBalanceConstraint(ConstraintMixin):
Check the object's consistency
"""
error_list = []
source_sum = dict()
destination_sum = dict()
source_sum = {}
destination_sum = {}
for line in obj.getMovementList(
portal_type=obj.getPortalAccountingMovementTypeList()):
if line.getSourceValue() is not None:
......
......@@ -132,7 +132,7 @@ class BalanceTransaction(AccountingTransaction, Inventory):
"""Looks the current stock by calling getInventoryList, and building a
dictionnary of InventoryKey
"""
current_stock = dict()
current_stock = {}
getInventoryList = self.getPortalObject()\
.portal_simulation.getInventoryList
section_uid = self.getDestinationSectionUid()
......@@ -247,7 +247,7 @@ class BalanceTransaction(AccountingTransaction, Inventory):
"""Looks the new stock on lines in this inventory, and building a
dictionnary of InventoryKey
"""
new_stock = dict()
new_stock = {}
# node
for movement in self._getGroupByNodeMovementList():
node_uid = movement.getDestinationUid()
......
......@@ -112,15 +112,15 @@ class BudgetLine(Predicate, XMLMatrix, VariatedMixin):
budget = self.getParentValue()
budget_model = budget.getSpecialiseValue(portal_type='Budget Model')
if budget_model is None:
return dict()
return {}
query_dict = budget_model.getInventoryListQueryDict(self)
query_dict.update(kw)
query_dict.setdefault('ignore_group_by', True)
sign = self.BudgetLine_getConsumptionSign()
cell_key_cache = dict()
budget_dict = dict()
cell_key_cache = {}
budget_dict = {}
portal = self.getPortalObject()
getInventoryList = portal.portal_simulation.getInventoryList
......
......@@ -97,7 +97,7 @@ class BudgetModel(Predicate):
def getInventoryQueryDict(self, budget_cell):
"""Returns the query dict to pass to simulation query for a budget cell
"""
query_dict = dict()
query_dict = {}
for budget_variation in sorted(self.contentValues(
portal_type=self.getPortalBudgetVariationTypeList()),
key=lambda x:x.getIntIndex()):
......@@ -115,7 +115,7 @@ class BudgetModel(Predicate):
def getInventoryListQueryDict(self, budget_line):
"""Returns the query dict to pass to simulation query for a budget line
"""
query_dict = dict()
query_dict = {}
for budget_variation in sorted(self.contentValues(
portal_type=self.getPortalBudgetVariationTypeList()),
key=lambda x:x.getIntIndex()):
......
......@@ -3557,11 +3557,9 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
def remove(self, context, **kw):
"""Conversion of magically uniqued paths to real ones"""
remove_object_dict = kw.get('remove_object_dict', {})
new_remove_dict = dict()
for k,v in remove_object_dict.iteritems():
if k.startswith(self.getTemplateTypeName()+'/'):
new_remove_dict[self._getPath(k)] = v
kw['remove_object_dict'] = new_remove_dict
kw['remove_object_dict'] = {self._getPath(k): v
for k, v in remove_object_dict.iteritems()
if k.startswith(self.getTemplateTypeName()+'/')}
BaseTemplateItem.remove(self, context, **kw)
def uninstall(self, context, **kw):
......@@ -3710,11 +3708,9 @@ class FilesystemToZodbTemplateItem(FilesystemDocumentTemplateItem,
Conversion of magically uniqued paths to real ones
"""
remove_object_dict = kw.get('remove_object_dict', {})
new_remove_dict = dict()
for k,v in remove_object_dict.iteritems():
if k.startswith(self.getTemplateTypeName()+'/'):
new_remove_dict[self._getPath(k)] = v
kw['remove_object_dict'] = new_remove_dict
kw['remove_object_dict'] = {self._getPath(k): v
for k, v in remove_object_dict.iteritems()
if k.startswith(self.getTemplateTypeName()+'/')}
ObjectTemplateItem.remove(self, context, **kw)
@staticmethod
......@@ -4567,7 +4563,7 @@ class LocalRolesTemplateItem(BaseTemplateItem):
local_roles_dict, local_roles_group_id_dict = self._objects[path]
else:
# old format, before local roles group id
local_roles_group_id_dict = dict()
local_roles_group_id_dict = None
local_roles_dict, = self._objects[path]
xml_data = '<local_roles_item>'
......@@ -4645,17 +4641,18 @@ class LocalRolesTemplateItem(BaseTemplateItem):
if len(self._objects[roles_path]) == 2:
local_roles_dict, local_roles_group_id_dict = self._objects[roles_path]
else:
local_roles_group_id_dict = dict()
local_roles_group_id_dict = None
local_roles_dict, = self._objects[roles_path]
setattr(obj, '__ac_local_roles__', local_roles_dict)
obj.__ac_local_roles__ = local_roles_dict
if local_roles_group_id_dict:
setattr(obj, '__ac_local_roles_group_id_dict__',
local_roles_group_id_dict)
obj.__ac_local_roles_group_id_dict__ = local_roles_group_id_dict
# we try to have __ac_local_roles_group_id_dict__ set only if
# it is actually defining something else than default
elif getattr(aq_base(obj), '__ac_local_roles_group_id_dict__',
None) is not None:
delattr(obj, '__ac_local_roles_group_id_dict__')
else:
try:
del obj.__ac_local_roles_group_id_dict__
except AttributeError:
pass
obj.reindexObject()
def uninstall(self, context, object_path=None, **kw):
......
......@@ -104,7 +104,7 @@ class CategoryBudgetVariation(BudgetVariation):
def getInventoryQueryDict(self, budget_cell):
""" Query dict to pass to simulation query
"""
query_dict = dict()
query_dict = {}
axis = self.getInventoryAxis()
if not axis:
return query_dict
......@@ -149,16 +149,16 @@ class CategoryBudgetVariation(BudgetVariation):
"""
axis = self.getInventoryAxis()
if not axis:
return dict()
return {}
base_category = self.getProperty('variation_base_category')
if not base_category:
return dict()
return {}
context = budget_line
if self.isMemberOf('budget_variation/budget'):
context = budget_line.getParentValue()
query_dict = dict()
query_dict = {}
if axis == 'movement':
axis = 'default_%s_uid' % base_category
query_dict['group_by'] = [axis]
......@@ -193,7 +193,7 @@ class CategoryBudgetVariation(BudgetVariation):
found = True
if found:
return query_dict
return dict()
return {}
def getBudgetVariationRangeCategoryList(self, context):
"""Returns the Variation Range Category List that can be applied to this
......
......@@ -95,7 +95,7 @@ class EmploymentContract(SubscriptionItem):
movement_stop_date = stop_date
if not self.assertMovementExists(applied_rule, movement_start_date) and\
movement_stop_date.month() <= number_of_months_in_year:
property_dict = dict()
property_dict = {}
simulation_movement = applied_rule.newContent(
id = 'movement_%s_%s' % (movement_start_date.year(), movement_stop_date.month()),
......
......@@ -139,7 +139,7 @@ class NodeBudgetVariation(BudgetVariation):
def getInventoryQueryDict(self, budget_cell):
""" Query dict to pass to simulation query
"""
query_dict = dict()
query_dict = {}
axis = self.getInventoryAxis()
if not axis:
return query_dict
......@@ -223,17 +223,17 @@ class NodeBudgetVariation(BudgetVariation):
"""
axis = self.getInventoryAxis()
if not axis:
return dict()
return {}
base_category = self.getProperty('variation_base_category')
if not base_category:
return dict()
return {}
context = budget_line
if self.isMemberOf('budget_variation/budget'):
context = budget_line.getParentValue()
portal_categories = self.getPortalObject().portal_categories
query_dict = dict()
query_dict = {}
uid_based_axis = False
if axis == 'movement':
axis = 'default_%s_uid' % base_category
......@@ -291,7 +291,7 @@ class NodeBudgetVariation(BudgetVariation):
else:
query_dict[axis] = Query(**{axis: None})
return query_dict
return dict()
return {}
def _getCellKeyFromInventoryListBrain(self, brain, budget_line,
cell_key_cache=None):
......
......@@ -278,7 +278,7 @@ class PDFDocument(Image):
"""Returns the information about the PDF document with pdfinfo.
"""
if not self.hasData():
return dict()
return {}
try:
return self._content_information.copy()
except AttributeError:
......
......@@ -27,6 +27,7 @@
#
##############################################################################
from collections import defaultdict
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
......@@ -94,7 +95,7 @@ class PackingList(Delivery):
"""
# build a mapping of
# (resource, variation_text) -> quantity
container_dict = dict()
container_dict = defaultdict(int)
for container in self.contentValues(
portal_type=self.getPortalContainerTypeList()):
for container_line in container.contentValues(
......@@ -104,13 +105,11 @@ class PackingList(Delivery):
portal_type=self.getPortalContainerLineTypeList(),):
key = (container_cell.getResource(),
container_cell.getVariationText())
container_dict[key] = container_dict.get(key, 0) +\
container_cell.getQuantity()
container_dict[key] += container_cell.getQuantity()
else:
key = (container_line.getResource(),
container_line.getVariationText())
container_dict[key] = container_dict.get(key, 0) +\
container_line.getQuantity()
container_dict[key] += container_line.getQuantity()
if not container_dict:
return False
......@@ -119,7 +118,7 @@ class PackingList(Delivery):
for movement in self.getMovementList():
key = (movement.getResource(),
movement.getVariationText())
if container_dict.get(key, None) != movement.getQuantity():
if container_dict.get(key) != movement.getQuantity():
return False
return True
......@@ -252,7 +252,7 @@ class SQLNonContinuousIncreasingIdGenerator(IdGenerator):
set_last_id_method = portal.IdTool_zSetLastId
if not isinstance(id_dict, dict):
raise TypeError, 'the argument given is not a dictionary'
new_id_dict = dict()
new_id_dict = {}
for key, value in id_dict.items():
if isinstance(value, int):
set_last_id_method(id_group=key, last_id=value)
......
......@@ -634,7 +634,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
"""
def __init__(self):
dict.__init__(self)
self.visited_movement_dict = dict()
self.visited_movement_dict = {}
path_tree = treeNode()
def updateTree(simulation_movement, path):
......
......@@ -496,7 +496,7 @@ class SimulationTool(BaseTool):
# group by involving a related key (eg. group_by=['product_line_uid'])
related_key_dict_passthrough_group_by = new_kw.get(
'related_key_dict_passthrough', dict()).pop('group_by', [])
'related_key_dict_passthrough', {}).pop('group_by', [])
if isinstance(related_key_dict_passthrough_group_by, basestring):
related_key_dict_passthrough_group_by = (
related_key_dict_passthrough_group_by,)
......@@ -506,13 +506,12 @@ class SimulationTool(BaseTool):
new_kw['group_by'] = group_by
# select expression
select_dict = new_kw.get('select_dict', dict())
select_dict = new_kw.setdefault('select_dict', {})
related_key_select_expression_list = new_kw.pop(
'related_key_select_expression_list', [])
for related_key_select in related_key_select_expression_list:
select_dict[related_key_select] = '%s_%s' % (table,
related_key_select)
new_kw['select_dict'] = select_dict
# Column values
column_value_dict = new_kw.pop('column_value_dict', {})
......
......@@ -82,7 +82,7 @@ way that parent always precedes their children.\n
from Products.ERP5Type.Message import translateString\n
from Products.ERP5OOo.OOoUtils import OOoParser\n
parser = OOoParser()\n
category_list_spreadsheet_mapping = dict()\n
category_list_spreadsheet_mapping = {}\n
error_list = []\n
\n
def default_invalid_spreadsheet_error_handler(error_message):\n
......
......@@ -68,7 +68,7 @@ workflow_id_list = [x for x, y in context.getWorkflowStateItemList()]\n
if not workflow_id in workflow_id_list:\n
return []\n
\n
actor_name_cache = dict()\n
actor_name_cache = {}\n
def getActorName(actor):\n
# returns the name of the actor. If it\'s a person, show the usual name of the person\n
try:\n
......
......@@ -61,8 +61,7 @@ def getHeaderTitle(property_id):\n
cat_info_list = []\n
for base_cat_id in context.REQUEST[\'category_list\']:\n
base_cat = context.portal_categories[base_cat_id]\n
d = dict()\n
d[\'base_cat\'] = base_cat\n
d = {\'base_cat\': base_cat}\n
d[\'cat_list\'] = cat_list = []\n
d[\'max_cat_depth\'] = max_cat_depth = 0\n
cat_info_list.append(d)\n
......@@ -82,13 +81,12 @@ for base_cat_id in context.REQUEST[\'category_list\']:\n
\n
result = []\n
for cat_info in cat_info_list:\n
table_dict = dict()\n
table_dict[\'name\'] = cat_info[\'base_cat\'].getId()\n
table_dict = {\'name\': cat_info[\'base_cat\'].getId()}\n
table_dict[\'row_list\'] = row_list = []\n
result.append(table_dict)\n
\n
# make headers\n
header_dict = dict()\n
header_dict = {}\n
table_dict[\'header_row\'] = header_dict\n
\n
cat_list = cat_info[\'cat_list\']\n
......@@ -99,12 +97,13 @@ for cat_info in cat_info_list:\n
header_dict[\'category_property_list\'] = [getHeaderTitle(property_id)\n
for property_id in editable_property_id_list]\n
for cat in cat_list:\n
row = dict()\n
row[\'path_cell_list\'] = [\'\'] * (max_cat_depth - 1)\n
row[\'path_cell_list\'][len(cat.getRelativeUrl().split(\'/\')) - 2] = \'*\'\n
row[\'category_property_list\'] = [cat.getProperty(property_id)\n
for property_id in editable_property_id_list]\n
row_list.append(row)\n
path_cell_list = [\'\'] * (max_cat_depth - 1)\n
path_cell_list[len(cat.getRelativeUrl().split(\'/\')) - 2] = \'*\'\n
category_property_list = map(cat.getProperty, editable_property_id_list)\n
row_list.append({\n
\'path_cell_list\': path_cell_list,\n
\'category_property_list\': category_property_list,\n
})\n
else:\n
header_dict[\'path_cell_list\'] = [\'Path\']\n
header_dict[\'category_property_list\'] = []\n
......
......@@ -271,23 +271,31 @@ for base_category_id in base_category_id_list:\n
# TODO: add a dialog parameter allowing to delete this path\n
if \'warning\' in displayed_report:\n
report_line = newTempBase(context, \'item\')\n
report_line.edit(field_type = \'Warning\', field_category = category.getRelativeUrl(), field_message = translateString("Category is used and can not be deleted or expired ", mapping=dict()))\n
report_line.edit(field_type=\'Warning\',\n
field_category=category.getRelativeUrl(),\n
field_message=translateString("Category is used and can not be deleted or expired "))\n
detailed_report_append(report_line)\n
else:\n
if existing_category_list == \'keep\' and \'kept\' in displayed_report:\n
report_line = newTempBase(context, \'item\')\n
report_line.edit(field_type = \'Keep\', field_category = category.getRelativeUrl(), field_message = translateString("Kept category", mapping=dict()))\n
report_line.edit(field_type=\'Keep\',\n
field_category=category.getRelativeUrl(),\n
field_message=translateString("Kept category"))\n
detailed_report_append(report_line)\n
kept_category_counter += 1\n
else:\n
if existing_category_list == \'delete\' and \'deleted\' in displayed_report:\n
report_line = newTempBase(context, \'item\')\n
report_line.edit(field_type = \'Delete\', field_category = category.getRelativeUrl(), field_message = translateString("Deleted category", mapping=dict()))\n
report_line.edit(field_type=\'Delete\',\n
field_category=category.getRelativeUrl(),\n
field_message=translateString("Deleted category"))\n
detailed_report_append(report_line)\n
deleted_category_counter += 1\n
if existing_category_list == \'expire\' and \'expired\' in displayed_report:\n
report_line = newTempBase(context, \'item\')\n
report_line.edit(field_type = \'Expire\', field_category = category.getRelativeUrl(), field_message = translateString("Expired category", mapping=dict()))\n
report_line.edit(field_type=\'Expire\',\n
field_category=category.getRelativeUrl(),\n
field_message=translateString("Expired category"))\n
detailed_report_append(report_line)\n
expired_category_counter += 1\n
category_to_delete_list.append(category.getRelativeUrl())\n
......
......@@ -59,16 +59,16 @@ The script must be called on the context of the document.\n
"""\n
from Products.ERP5Type.Cache import CachingMethod\n
def filterDuplicateActions(actions):\n
new_actions = dict()\n
new_actions = {}\n
\n
for action_category, action_list in actions.items():\n
existing_actions = dict()\n
existing_actions = set()\n
new_actions[action_category] = []\n
keep_action = new_actions[action_category].append\n
\n
for action in action_list:\n
if action[\'id\'] not in existing_actions:\n
existing_actions[action[\'id\']] = 1\n
existing_actions.add(action[\'id\'])\n
keep_action(action)\n
return new_actions\n
\n
......
......@@ -416,7 +416,7 @@ class TestBudget(ERP5TypeTestCase):
# a confirmed transaction engages budget
self.tic()
self.assertEqual(dict(), budget_line.getConsumedBudgetDict())
self.assertEqual({}, budget_line.getConsumedBudgetDict())
self.assertEqual(
{('source/account_module/fixed_assets', 'account_type/asset'): -100.0,
......
......@@ -217,7 +217,7 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase):
movement_group_node = self.builder.collectMovement(movement_list)
group_list = movement_group_node.getGroupList()
self.assertEqual(1, len(group_list))
self.assertEqual(dict(), group_list[0].getGroupEditDict())
self.assertEqual({}, group_list[0].getGroupEditDict())
class TestOrderMovementGroup(MovementGroupTestCase):
"""Tests Order Movement Group - grouping and separating by
......
......@@ -105,7 +105,7 @@ class IndexableObjectWrapper(object):
getSQLCatalogRoleKeysList())
getUserById = portal.acl_users.getUserById
allowed_dict = dict()
allowed_dict = {}
# For each local role of a user:
# If the local role grants View permission, add it.
......@@ -126,7 +126,7 @@ class IndexableObjectWrapper(object):
# XXX make this a method of base ?
local_roles_group_id_group_id = deepcopy(getattr(ob,
'__ac_local_roles_group_id_dict__', dict()))
'__ac_local_roles_group_id_dict__', {}))
# If we acquire a permission, then we also want to acquire the local
# roles group ids
......@@ -137,7 +137,7 @@ class IndexableObjectWrapper(object):
for role_definition_group, user_and_role_list in \
getattr(local_roles_container,
'__ac_local_roles_group_id_dict__',
dict()).items():
{}).items():
local_roles_group_id_group_id.setdefault(role_definition_group, set()
).update(user_and_role_list)
else:
......
......@@ -146,26 +146,25 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# If we add default here, it should also be used in build
# ...
category_path_dict = dict()
for item in cache[base_category_id]:
category_path_dict[item['path']] = item
category_path_dict = {item['path']: item
for item in cache[base_category_id]}
for item in cache[base_category_id]:
for path, item in category_path_dict.iteritems():
# the first item in this list is the base category itself, so we skip it.
if item['path'] == base_category_id:
if path == base_category_id:
continue
# recreate logical path
path_element_list = []
title_list = []
for path_element in item['path'].split('/'):
for path_element in path.split('/'):
path_element_list.append(path_element)
title_list.append(category_path_dict['/'.join(path_element_list)]['title'])
if base:
result.append(('/'.join(title_list[1:]), item['path']))
result.append(('/'.join(title_list[1:]), path))
else:
result.append(('/'.join(title_list[1:]),
'/'.join(item['path'].split('/')[1:])))
'/'.join(path.split('/')[1:])))
return result
......@@ -113,7 +113,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
def _getPortalTypeRoleDict(self):
"""Read the spreadsheet and provide processed dict.
"""
role_dict = dict()
role_dict = {}
info_dict = self.ConfigurationTemplate_readOOCalcFile(
"portal_roles_spreadsheet.ods",
data=self.getDefaultConfigurationSpreadsheetData())
......
......@@ -114,7 +114,7 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw):
marker = []
# this will be a dictionnary with (portal_type, workflow_id, workflow_state)
# as keys, and (count, a random document) as values
workflow_state_dict = dict()
workflow_state_dict = {}
for document in selected_document_list:
for state_var in possible_state_list:
......@@ -124,12 +124,12 @@ def getDocumentGroupByWorkflowStateList(self, form_id='', **kw):
if state_var == workflow.variables.getStateVar():
key = (document.getPortalTypeName(), workflow.getId(),
document.getProperty(state_var))
document_count = workflow_state_dict.get(key, [None, 0])[1]
document_count = workflow_state_dict.get(key, (None, 0))[1]
workflow_state_dict[key] = document, document_count + 1
for (ptype, workflow_id, state), (doc, document_count) in\
workflow_state_dict.items():
workflow_state_dict.iteritems():
workflow = wf_tool.getWorkflowById(workflow_id)
state_var = workflow.variables.getStateVar()
translated_workflow_state_title = doc.getProperty(
......
......@@ -299,17 +299,17 @@ def getSearchDialog(self, REQUEST=None):
allowed_content_types = self.getTypeInfo().getTypeAllowedContentTypeList()
# remember which workflow we already displayed
workflow_dict = dict()
workflow_set = set()
# possible workflow states
for type_name in allowed_content_types:
for workflow_id in workflow_tool.getChainFor(type_name):
workflow = workflow_tool.getWorkflowById(workflow_id)
state_var = workflow.variables.getStateVar()
if state_var in workflow_dict:
if state_var in workflow_set:
continue
workflow_dict[state_var] = 1
workflow_set.add(state_var)
if workflow.states is None or \
len(workflow.states.objectIds()) <= 1:
continue
......
......@@ -1145,17 +1145,13 @@ class ListBoxRenderer:
list_style_column_change_required = listbox_display_style not in ('', DEFAULT_LISTBOX_DISPLAY_STYLE,)
if dynamic_column_list_override:
# dynamically setting columns is supported
available_column = self.getAllColumnList()
#Create a dict to make a easy search
available_column_dict = dict()
for id,title in available_column:
available_column_dict[id] = (id,title)
available_column_dict = {x[0]: x for x in self.getAllColumnList()}
# We check columns are present
for id in self.getDisplayedColumnIdList():
if available_column_dict.has_key(id):
try:
column_list.append(available_column_dict[id])
else:
except KeyError:
raise AttributeError, "Column %s is not avaible" % id
elif list_style_column_change_required and not dynamic_column_list_override:
# no dynamically setting of columns happens , still we have different than default
......
......@@ -790,7 +790,7 @@ class TestProxyField(ERP5TypeTestCase):
# beware that all values that are not passed in the mapping will be
# delegated again, regardless of the old state.
proxy_field.manage_edit_surcharged_xmlrpc(dict())
proxy_field.manage_edit_surcharged_xmlrpc({})
self.assertTrue(proxy_field.is_delegated('title'))
def test_same_field_id_in_proxy_field_and_template_field(self):
......
......@@ -516,7 +516,7 @@ class OOoTemplate(ZopePageTemplate):
self.OLE_documents_zipstring = None
# Convert if necessary
opts = extra_context.get("options", dict())
opts = extra_context.get("options", {})
# Get batch_mode
batch_mode = opts.get('batch_mode', None)
......
......@@ -1327,7 +1327,7 @@ class TestDocument(TestDocumentMixin):
document = self.portal.document_module.newContent(portal_type='PDF')
content_information = document.getContentInformation()
# empty PDF have no content information
self.assertEqual(dict(), content_information)
self.assertEqual({}, content_information)
def test_apple_PDF_metadata(self):
# PDF created with Apple software have a special 'AAPL:Keywords' info tag
......
......@@ -84,7 +84,7 @@ class EssendexGateway(XMLObject):
def _fetchPageAsDict(self,page):
"""Page result is like Key=value in text format.
We transform it to a more powerfull dictionnary"""
result = dict()
result = {}
index = 0
#Read all lines
......
......@@ -83,7 +83,7 @@ class MobytGateway(XMLObject):
def _fetchSendResponseAsDict(self,page):
"""Page result is like Key=value in text format.
We transform it to a more powerfull dictionnary"""
result = dict()
result = {}
lines = page.readlines()
assert len(lines) == 1, "Multi lines response is not managed %s" % lines
line = lines[0]
......@@ -98,7 +98,7 @@ class MobytGateway(XMLObject):
def _fetchStatusResponseAsDict(self,page):
"""Page result is like Key=value in text format.
We transform it to a more powerfull dictionnary"""
result = dict()
result = {}
lines = page.readlines()
#First line is special : CSV column title or error inform
......
......@@ -502,8 +502,8 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
portal_workflow = aq_inner(portal_workflow)
portal_type = ptype_klass.__name__
dc_workflow_dict = dict()
interaction_workflow_dict = dict()
dc_workflow_dict = {}
interaction_workflow_dict = {}
for wf in portal_workflow.getWorkflowsFor(portal_type):
wf_id = wf.id
wf_type = wf.__class__.__name__
......@@ -536,9 +536,9 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
# extract Trigger transitions from workflow definitions for later
transition_id_set = set(transitions.objectIds())
trigger_dict = dict()
trigger_dict = {}
for tr_id in transition_id_set:
tdef = transitions.get(tr_id, None)
tdef = transitions[tr_id]
if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD:
trigger_dict[tr_id] = tdef
......@@ -548,8 +548,9 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
transition_id_set, trigger_dict = v
for tr_id, tdef in trigger_dict.iteritems():
method_id = convertToMixedCase(tr_id)
method = getattr(ptype_klass, method_id, _MARKER)
if method is _MARKER:
try:
method = getattr(ptype_klass, method_id)
except AttributeError:
ptype_klass.security.declareProtected(Permissions.AccessContentsInformation,
method_id)
ptype_klass.registerWorkflowMethod(method_id, wf_id, tr_id)
......
......@@ -58,7 +58,7 @@ class AttributeEquality(PropertyExistence):
errors = PropertyExistence._checkConsistency(self, obj, fixit=fixit)
for attribute_name, expected_value in self.constraint_definition.items():
message_id = None
mapping = dict()
mapping = {}
# If property does not exist, error will be raised by
# PropertyExistence Constraint.
if obj.hasProperty(attribute_name):
......
......@@ -49,8 +49,8 @@ class Constraint:
self.id = id
self.description = description
self.type = type
self.constraint_definition = dict()
self.message_id_dict = dict()
self.constraint_definition = {}
self.message_id_dict = {}
self.edit(id, description, type, condition, **constraint_definition)
def edit(self, id=None, description=None, type=None, condition=None,
......
......@@ -118,7 +118,7 @@ class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
Call before actually converting the attributes common to all
constraints
"""
return dict()
return {}
@staticmethod
def _convertFromFilesystemDefinition(*args, **kw):
......@@ -133,7 +133,7 @@ class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
@see importFromFilesystemDefinition
"""
yield dict()
yield {}
security.declareProtected(Permissions.AccessContentsInformation,
'importFromFilesystemDefinition')
......
......@@ -417,7 +417,7 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
if password is None:
password = reference
if person_kw is None:
person_kw = dict()
person_kw = {}
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference,
......
......@@ -3063,15 +3063,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
portal_actions.deleteActions(selections=index_list)
def test_propertyMap_unique_properties(self):
portal = self.getPortalObject()
person = portal.person_module.newContent(portal_type='Person')
property_id_dict = dict()
non_unique_property_id_list = []
for property_id in [p['id'] for p in person.propertyMap()]:
if property_id in property_id_dict:
non_unique_property_id_list.append(property_id)
property_id_dict[property_id] = 1
self.assertEqual([], non_unique_property_id_list)
person = self.portal.person_module.newContent(portal_type='Person')
property_id_list = [p['id'] for p in person.propertyMap()]
self.assertEqual(len(property_id_list), len(set(property_id_list)),
property_id_list)
def testLocalProperties(self):
portal = self.getPortalObject()
......
......@@ -163,14 +163,11 @@ class DummyLocalizer:
self.lang = lang
def translate(self, domain, msgid, lang=None, mapping=None, *args, **kw):
params = dict()
for key in ('lang', 'add', 'default'):
if key in kw:
params[key] = kw[key]
if lang is not None:
params['lang'] = lang
params = {key: kw[key] for key in ('add', 'default') if key in kw}
if 'target_language' in kw:
params['lang'] = kw['target_language']
elif lang is not None:
params['lang'] = lang
msg = getattr(self, domain, self.default).gettext(msgid, **params)
if mapping:
# this is a simpler version that does not handle unicode
......
......@@ -92,7 +92,7 @@ class ColumnMap(object):
self.raw_column_dict = {}
# Entries: column name
self.column_ignore_set = set()
self.join_table_map = dict()
self.join_table_map = {}
# BBB: Remove join_query_list and its uses when all RelatedKey
# methods have been converted to properly return each Join
# condition separately, and all uses of catalog's from_expression
......
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