Commit c11e08ba authored by Arnaud Fontaine's avatar Arnaud Fontaine

WIP: 2to3: iteritems/itervalues.

parent 5b1d72b4
......@@ -59,7 +59,7 @@ class ActivityBuffer(TM):
try:
activity_tool = self.activity_tool
# Try to push all messages
for activity, message_list in self.message_list_dict.iteritems():
for activity, message_list in six.iteritems(self.message_list_dict):
activity.prepareQueueMessageList(activity_tool, message_list)
self.message_list_dict.clear()
self.activity_tool = None
......
......@@ -702,7 +702,7 @@ class ActivityTool (BaseTool):
security.declarePrivate('initialize')
def initialize(self):
self.maybeMigrateConnectionClass()
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
activity.initialize(self, clear=False)
# Remove old skin if any.
skins_tool = self.getPortalObject().portal_skins
......@@ -1328,7 +1328,7 @@ class ActivityTool (BaseTool):
Distribute load
"""
# Call distribute on each queue
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
activity.distribute(aq_inner(self), node_count)
security.declarePublic('tic')
......@@ -1392,7 +1392,7 @@ class ActivityTool (BaseTool):
quote = db.string_literal
return bool(db.query("(%s)" % ") UNION ALL (".join(
activity.hasActivitySQL(quote, path=path, **kw)
for activity in activity_dict.itervalues()))[1])
for activity in six.itervalues(activity_dict)))[1])
security.declarePrivate('getActivityBuffer')
def getActivityBuffer(self, create_if_not_found=True):
......@@ -1494,7 +1494,7 @@ class ActivityTool (BaseTool):
object_path = obj
else:
object_path = obj.getPhysicalPath()
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
activity.flush(aq_inner(self), object_path, invoke=invoke, **kw)
def invoke(self, message):
......@@ -1629,7 +1629,7 @@ class ActivityTool (BaseTool):
error_log.raising(exc_info)
else:
# Note there can be partial failures.
for m, expanded_object_list in message_dict.iteritems():
for m, expanded_object_list in six.iteritems(message_dict):
result_list = []
for result in expanded_object_list:
try:
......@@ -1741,7 +1741,7 @@ class ActivityTool (BaseTool):
"""
Recreate tables, clearing all activities
"""
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
activity.initialize(self, clear=True)
if RESPONSE is not None:
......@@ -1770,7 +1770,7 @@ class ActivityTool (BaseTool):
return activity_dict[activity].getMessageList(aq_inner(self), **kw)
message_list = []
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
try:
message_list += activity.getMessageList(aq_inner(self), **kw)
except AttributeError:
......@@ -1800,7 +1800,7 @@ class ActivityTool (BaseTool):
quote = db.string_literal
return sum(x for x, in db.query("(%s)" % ") UNION ALL (".join(
activity.countMessageSQL(quote, **kw)
for activity in activity_dict.itervalues()))[1])
for activity in six.itervalues(activity_dict)))[1])
security.declareProtected( CMFCorePermissions.ManagePortal , 'newActiveProcess' )
def newActiveProcess(self, REQUEST=None, **kw):
......@@ -1813,11 +1813,11 @@ class ActivityTool (BaseTool):
security.declarePrivate('getSQLTableNameSet')
def getSQLTableNameSet(self):
return [x.sql_table for x in activity_dict.itervalues()]
return [x.sql_table for x in six.itervalues(activity_dict)]
# Required for tests (time shift)
def timeShift(self, delay):
for activity in activity_dict.itervalues():
for activity in six.itervalues(activity_dict):
activity.timeShift(aq_inner(self), delay)
InitializeClass(ActivityTool)
......@@ -118,7 +118,7 @@ class Balancer:
if addr not in self.disabled_server_dict:
count_dict[addr] = 0
expired_server_list = []
for key,value in self.sticked_server_dict.items():
for key,value in six.iteritems(self.sticked_server_dict):
if self.debug:
print('cur_time = %f, value.atime = %f' % (cur_time, value.atime))
if cur_time > value.atime + 60 * 10:
......
......@@ -75,7 +75,7 @@ class Filter(Implicit):
return False
if self.filter_leave and not self._isNode(context):
return False
for k, v in self.filter_dict.items():
for k, v in six.iteritems(self.filter_dict):
if type(v) in (type([]), type(())):
if context.getProperty(k) not in v:
return False
......
......@@ -39,7 +39,7 @@ def dump_threads():
this_thread_id = thread.get_ident()
now = time.strftime("%Y-%m-%d %H:%M:%S")
res = ["Threads traceback dump at %s\n" % now]
for thread_id, frame in _current_frames().iteritems():
for thread_id, frame in six.iteritems(_current_frames()):
if thread_id == this_thread_id:
continue
......
This diff is collapsed.
......@@ -945,7 +945,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
uid = self.getUid()
row_list = []
for unit_uid, value in self._getQuantityUnitDefinitionDict().iteritems():
for unit_uid, value in six.iteritems(self._getQuantityUnitDefinitionDict()):
definition_uid, quantity = value
row_list.append(dict(uid=definition_uid,
resource_uid=uid,
......@@ -977,7 +977,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
metric_type_map[metric_type] = measure
insert_list = []
for measure in metric_type_map.itervalues():
for measure in six.itervalues(metric_type_map):
if measure is not None:
insert_list += measure.asCatalogRowList(quantity_unit_definition_dict)
......
......@@ -2492,7 +2492,7 @@ def initialize(self):
REQUEST.RESPONSE.unauthorized()
newSecurityManager(None, user.__of__(uf))
manage_addERP5Site(app.__of__(RequestContainer(REQUEST=REQUEST)),
**{k: kw.get(k, v) for k, v in default_kw.iteritems()
**{k: kw.get(k, v) for k, v in six.iteritems(default_kw)
if isinstance(v, str)})
transaction.get().note('Created ' + meta_type)
transaction.commit()
......
......@@ -70,7 +70,7 @@ def diff_objects(object_a, object_b):
for property_dict_id in ('values', 'tales', 'overrides'):
a_property_dict = getattr(field_a, property_dict_id)
b_property_dict = getattr(field_b, property_dict_id)
for property_id, a_property_value in a_property_dict.iteritems():
for property_id, a_property_value in six.iteritems(a_property_dict):
b_property_value = b_property_dict[property_id]
if a_property_value != b_property_value:
if isinstance(a_property_value, str) and isinstance(b_property_value, str):
......
......@@ -121,7 +121,7 @@ class Amount(Base, VariatedMixin):
render_category_list = Renderer(display_id=display_id, **kw).render
kw['display_id'] = 'title'
for base_category, (object_list,
category_list) in variation_dict.iteritems():
category_list) in six.iteritems(variation_dict):
if base_category_list and base_category not in base_category_list:
continue
variation_category_item_list += render_category_list(category_list)
......
......@@ -230,7 +230,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
sm_dict = old_dict.setdefault(line, {})
recurse_list = deque(({get_matching_key(sm): (sm,)},))
while recurse_list:
for k, x in recurse_list.popleft().iteritems():
for k, x in six.iteritems(recurse_list.popleft()):
if not k:
continue
if len(x) > 1:
......
......@@ -869,7 +869,7 @@ class BusinessProcess(Path, XMLObject):
if trade_phase_list: # reduce graph
next_dict = defaultdict(set)
# build {phase: next_set} (i.e. reverse result)
for next_, phase_set in result.iteritems():
for next_, phase_set in six.iteritems(result):
for phase in phase_set:
next_dict[phase].add(next_)
# for each phase to remove
......
......@@ -73,9 +73,9 @@ class ContributionPredicate(Predicate, XMLObject):
if getattr(aq_base(self), '_identity_criterion', None) is None:
self._identity_criterion = {}
self._range_criterion = {}
for property_, value in self._identity_criterion.iteritems():
for property_, value in six.iteritems(self._identity_criterion):
result = result and (context.getProperty(property_) in value)
for property_, (min_, max_) in self._range_criterion.iteritems():
for property_, (min_, max_) in six.iteritems(self._range_criterion):
value = context.getProperty(property_)
if min_ is not None:
result = result and (value >= min_)
......
......@@ -673,7 +673,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
path_set_to_check):
yield d
for id_, t in tree_node.visited_movement_dict.iteritems():
for id_, t in six.iteritems(tree_node.visited_movement_dict):
subdocument, path = t
to_check = path_set_to_check
# do we need to change/copy the set?
......
......@@ -415,7 +415,7 @@ class AmountGeneratorMixin:
del cell_aggregate[self_key]
# Allow base_application & base_contribution to be variated.
for property_dict in cell_aggregate.itervalues():
for property_dict in six.itervalues(cell_aggregate):
base_amount_set = property_dict['base_application_set']
variation_list = tuple(sorted(x for x in base_amount_set
if not x.startswith('base_amount/')))
......@@ -481,7 +481,7 @@ class AmountGeneratorMixin:
amount._setQuantity(quantity)
amount._setTitle(self.getTitle())
amount._setDescription(self.getDescription())
for x in property_dict.iteritems():
for x in six.iteritems(property_dict):
amount._setProperty(*x)
# convert to default management unit if possible
amount._setQuantity(amount.getConvertedQuantity())
......
......@@ -164,7 +164,7 @@ class DiscoverableMixin(CachedConvertableMixin):
else:
result = method()
if result is not None:
for key, value in result.iteritems():
for key, value in six.iteritems(result):
if value not in (None, ''):
kw[key]=value
# Prepare the content edit parameters
......
......@@ -87,7 +87,7 @@ class GeneratedAmountList(list):
else:
aggregate[1] += amount.getQuantity()
from erp5.component.document.RoundingModel import RoundingProxy
for amount, quantity in aggregate_dict.itervalues():
for amount, quantity in six.itervalues(aggregate_dict):
# Before we ignore 'quantity==0' amount here for better performance,
# but it is not a good idea, especially when the first expand causes
# non-zero quantity and then quantity becomes zero.
......
......@@ -61,7 +61,7 @@ class TextContent:
title = tree.find("head/title")
if title is not None:
headers["title"] = title.text
return {k: v if len(v) > 1 else v[0] for k, v in headers.iteritems()}
return {k: v if len(v) > 1 else v[0] for k, v in six.iteritems(headers)}
## FTP handlers
security.declareProtected(Permissions.ModifyPortalContent, 'PUT')
......
......@@ -61,7 +61,7 @@ if detailed_report_result:
REQUEST.RESPONSE.setStatus(200, 'OK', lock=True)
raise Exception('Spreadsheet contains errors')
for base_category, category_list in category_list_spreadsheet_dict.iteritems():
for base_category, category_list in six.iteritems(category_list_spreadsheet_dict):
total_category_counter += len(category_list)
category_path_set = set()
for category in category_list:
......@@ -108,7 +108,7 @@ for base_category, category_list in category_list_spreadsheet_dict.iteritems():
category_path_set.add(category_value.getRelativeUrl())
category_update_dict = {}
for key, value in category.iteritems():
for key, value in six.iteritems(category):
if not create_local_property and key not in category_type_property_id_set:
report(
field_type='Update',
......
......@@ -143,7 +143,7 @@ class RuleTool(BaseTool):
for m in message_list:
expandable_dict[m.object].append(m)
try:
for expandable, message_list in expandable_dict.iteritems():
for expandable, message_list in six.iteritems(expandable_dict):
kw = {}
for m in message_list:
kw.update(m.kw)
......
......@@ -436,15 +436,14 @@ class SimulationTool(BaseTool):
# Column values
column_value_dict = new_kw.pop('column_value_dict', {})
for key, value in column_value_dict.iteritems():
for key, value in six.iteritems(column_value_dict):
new_kw['%s.%s' % (table, key)] = value
# Related keys
# First, the passthrough (acts as default values)
for key, value in new_kw.pop('related_key_dict_passthrough', {})\
.iteritems():
for key, value in new_kw.pop('related_key_dict_passthrough', six.iteritems({})):
new_kw[key] = value
# Second, calculated values
for key, value in new_kw.pop('related_key_dict', {}).iteritems():
for key, value in new_kw.pop('related_key_dict', six.iteritems({})):
new_kw['%s_%s' % (table, key)] = value
# Simulation states matched with input and output omission
def getSimulationQuery(simulation_dict, omit_dict):
......
......@@ -27,7 +27,7 @@ query_list = [
),
logical_operator='and',
)
for original_message, portal_type_set in original_message_dict.iteritems()
for original_message, portal_type_set in six.iteritems(original_message_dict)
]
if len(query_list) == 1:
return query_list[0]
......
......@@ -41,7 +41,7 @@ for f in form.get_fields():
listbox = request.get('listbox') # XXX: hardcoded field name
if listbox is not None:
listbox_line_list = []
for key, value in sorted(listbox.iteritems()):
for key, value in six.iteritems(sorted(listbox)):
value['listbox_key'] = key
listbox_line_list.append(value)
doaction_param_list['listbox'] = tuple(listbox_line_list)
......
......@@ -159,7 +159,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
test_page = self.portal.portal_components[test_component_id]
for property_id, property_value in test_component_kw.iteritems():
for property_id, property_value in six.iteritems(test_component_kw):
self.assertEqual(test_page.getProperty(property_id), property_value)
def test_twoFileImportExportForWebPage(self):
......@@ -211,7 +211,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
(js_file_id, js_document_kw),
(css_file_id, css_document_kw)]:
web_page = self.portal.web_page_module[web_file[0]]
for property_id, property_value in web_file[1].iteritems():
for property_id, property_value in six.iteritems(web_file[1]):
self.assertEqual(web_page.getProperty(property_id), property_value)
def test_twoFileImportExportForPythonScript(self):
......@@ -275,7 +275,7 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
import_template.install()
image_page = self.portal.image_module[image_file_id]
for property_id, property_value in image_document_kw.iteritems():
for property_id, property_value in six.iteritems(image_document_kw):
self.assertEqual(image_page.getProperty(property_id), property_value)
......@@ -344,7 +344,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
file_page = self.portal.document_module[file_id]
for property_id, property_value in file_document_kw.iteritems():
for property_id, property_value in six.iteritems(file_document_kw):
self.assertEqual(getattr(file_page, property_id), property_value)
def test_twoFileImportExportForFileIdentifyingTypeByContentTypeJS(self):
......@@ -515,7 +515,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
file_page = self.portal.portal_skins[skin_folder_id][test_file_id]
for property_id, property_value in file_document_kw.iteritems():
for property_id, property_value in six.iteritems(file_document_kw):
self.assertEqual(getattr(file_page, property_id), property_value)
def test_twoFileImportExportForPDF(self):
......@@ -570,7 +570,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page = catalog[method_id]
for property_id, property_value in method_document_kw.iteritems():
for property_id, property_value in six.iteritems(method_document_kw):
self.assertEqual(getattr(method_page, property_id), property_value)
def test_twoFileImportExportForERP5SQLMethodInCatalog(self):
......@@ -618,7 +618,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page = catalog[method_id]
for property_id, property_value in method_document_kw.iteritems():
for property_id, property_value in six.iteritems(method_document_kw):
self.assertEqual(getattr(method_page, property_id), property_value)
def test_twoFileImportExportForCatalogMethodInPortalSkins(self):
......@@ -664,7 +664,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
method_page = skin_folder[method_id]
for property_id, property_value in method_document_kw.iteritems():
for property_id, property_value in six.iteritems(method_document_kw):
self.assertEqual(getattr(method_page, property_id), property_value)
def test_twoFileImportExportForZopePageTemplate(self):
......@@ -703,7 +703,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
page_template_page = self.portal.portal_skins[skin_folder_id][page_template_id]
for property_id, property_value in page_template_kw.iteritems():
for property_id, property_value in six.iteritems(page_template_kw):
self.assertEqual(getattr(page_template_page, property_id), property_value)
def test_twoFileImportExportForDTMLMethodIdentifyingTypeByTitle(self):
......@@ -754,7 +754,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
dtml_method_page = self.portal.portal_skins[skin_folder_id][dtml_method_id]
for property_id, property_value in dtml_method_kw.iteritems():
for property_id, property_value in six.iteritems(dtml_method_kw):
self.assertEqual(getattr(dtml_method_page, property_id), property_value)
def test_twoFileImportExportForDTMLMethodNotIdentifyingType(self):
......@@ -805,7 +805,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
dtml_method_page = self.portal.portal_skins[skin_folder_id][dtml_method_id]
for property_id, property_value in dtml_method_kw.iteritems():
for property_id, property_value in six.iteritems(dtml_method_kw):
self.assertEqual(getattr(dtml_method_page, property_id), property_value)
def test_twoFileImportExportForOOoTemplate(self):
......@@ -850,7 +850,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
OOo_template_page = self.portal.portal_skins[skin_folder_id][OOo_template_id]
for property_id, property_value in OOo_template_kw.iteritems():
for property_id, property_value in six.iteritems(OOo_template_kw):
self.assertEqual(getattr(OOo_template_page, property_id), property_value)
def test_twoFileImportExportForSpreadsheetNotIdentifyingType(self):
......@@ -917,7 +917,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
test_page = self.portal.test_page_module[test_page_id]
for property_id, property_value in test_page_data_kw.iteritems():
for property_id, property_value in six.iteritems(test_page_data_kw):
self.assertEqual(getattr(test_page, property_id), property_value)
def test_twoFileImportExportForERP5PythonScript(self):
......@@ -961,7 +961,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
python_script_page = self.portal.portal_skins[skin_folder_id][python_script_id]
for property_id, property_value in python_script_kw.iteritems():
for property_id, property_value in six.iteritems(python_script_kw):
self.assertEqual(getattr(python_script_page, property_id), property_value)
def test_templateFolderIsCleanedUpInImportAndReexport(self):
......@@ -1129,7 +1129,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
# check that the page template has the expected attributes
# but the installed version encoding is utf-8
page_template = self.portal.portal_skins[skin_folder_id][page_template_id]
for property_id, property_value in page_template_kw.iteritems():
for property_id, property_value in six.iteritems(page_template_kw):
self.assertEqual(getattr(page_template, property_id), property_value)
# uninstall and export the business template
......
......@@ -1593,7 +1593,7 @@ class TestInventoryList(InventoryAPITestCase):
resource_uid = resource.getUid()
# create all movements
for month, value in data.iteritems():
for month, value in six.iteritems(data):
for mov in value['movement_list']:
d = DateTime('%s/15 15:00 UTC' % month)
self._makeMovement(start_date=d, resource_uid=resource_uid, **mov)
......@@ -1618,7 +1618,7 @@ class TestInventoryList(InventoryAPITestCase):
'2011/01':
dict(movement_list=[h(22, 8910)], after=h(291, 133344)),
}
for month, value in internal_data.iteritems():
for month, value in six.iteritems(internal_data):
for mov in value['movement_list']:
d = DateTime('%s/15 15:00 UTC' % month)
self._makeMovement(is_internal=1, start_date=d, resource_uid=resource_uid, **mov)
......@@ -2764,8 +2764,8 @@ class TestTrackingList(InventoryAPITestCase):
node_1_uid: 1,
node_2_uid: 2
}
for date, location_dict in date_location_dict.iteritems():
for param_id, location_uid in location_dict.iteritems():
for date, location_dict in six.iteritems(date_location_dict):
for param_id, location_uid in six.iteritems(location_dict):
param_dict = {param_id: date}
uid_list = [x.node_uid for x in getTrackingList(
aggregate_uid=self.item.getUid(), **param_dict)]
......@@ -2945,7 +2945,7 @@ class TestInventoryCacheTable(InventoryAPITestCase):
True: all values from criterion_dict match given inventory_line.
False otherwise.
"""
for criterion_id, criterion_value in criterion_dict.iteritems():
for criterion_id, criterion_value in six.iteritems(criterion_dict):
if criterion_id not in inventory_line \
or criterion_value != inventory_line[criterion_id]:
return False
......@@ -3733,7 +3733,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
def setUpUnitDefinition(self):
unit_module = self.portal.quantity_unit_conversion_module
for base, t in self.QUANTITY_UNIT_DICT.iteritems():
for base, t in six.iteritems(self.QUANTITY_UNIT_DICT):
standard, definition_dict = t
group = unit_module._getOb(base, None)
......@@ -3745,7 +3745,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
if group.getValidationState() in ('draft', 'invalidated'):
group.validate()
for unit, amount in definition_dict.iteritems():
for unit, amount in six.iteritems(definition_dict):
definition = group._getOb(unit, None)
if definition is None:
definition = group.newContent(
......@@ -3776,7 +3776,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
def getNeededCategoryList(self):
category_list = ['metric_type/' + c for c in self.METRIC_TYPE_CATEGORY_LIST]
for base, t in self.QUANTITY_UNIT_DICT.iteritems():
for base, t in six.iteritems(self.QUANTITY_UNIT_DICT):
standard, definition_dict = t
quantity = 'quantity_unit/%s/' % base
......
......@@ -113,8 +113,8 @@ class TestSpellChecking(ERP5TypeTestCase):
"""
message = '"%s" is misspelled, suggestion are : "%s"'
result_dict = {}
for word, result_list in self.spellChecker(sentence).iteritems():
filtered_result_list = filter(lambda x: x not in ('*', ''), result_list)
for word, result_list in six.iteritems(self.spellChecker(sentence)):
filtered_result_list = [x for x in result_list if x not in ('*', '')]
if filtered_result_list:
result_dict[word] = message % (word, \
filtered_result_list[0].split(':')[-1].strip())
......
......@@ -109,7 +109,7 @@ class BusinessTemplateInfoBase:
def parse(file_path):
action_information = importXML(connection, file_path)
action_information.__repr__()
for key, value in action_information.__dict__.iteritems():
for key, value in six.iteritems(action_information.__dict__):
if value not in (None, "") and key in ('action', 'condition') :
setattr(action_information, key, value.text)
actions = action_information.__dict__.copy()
......
......@@ -112,7 +112,7 @@ class IndexableObjectWrapper(object):
skip_role_set = set()
skip_role = skip_role_set.add
clear_skip_role = skip_role_set.clear
for group_id, role_list in mergedLocalRoles(ob).iteritems():
for group_id, role_list in six.iteritems(mergedLocalRoles(ob)):
new_role_list = []
new_role = new_role_list.append
clear_skip_role()
......@@ -142,7 +142,7 @@ class IndexableObjectWrapper(object):
no_indexable_role = self.__catalog_role_set.isdisjoint
return (
group_id
for group_id, role_list in self.__getLocalRoleDict().iteritems()
for group_id, role_list in six.iteritems(self.__getLocalRoleDict())
if group_id not in self.__user_set and
# group_id is returned only if any of its roles is indexable
not no_indexable_role(role_list)
......@@ -197,7 +197,7 @@ class IndexableObjectWrapper(object):
'': allowed_role_set,
}
optimized_role_set = set()
for role_definition_group, user_and_role_list in local_roles_group_id_dict.iteritems():
for role_definition_group, user_and_role_list in six.iteritems(local_roles_group_id_dict):
group_allowed_set = allowed_by_local_roles_group_id.setdefault(
role_definition_group,
set(),
......@@ -212,7 +212,7 @@ class IndexableObjectWrapper(object):
user_view_permission_role_dict = {}
catalog_role_set = self.__catalog_role_set
user_set = self.__user_set
for group_id, role_list in self.__getLocalRoleDict().iteritems():
for group_id, role_list in six.iteritems(self.__getLocalRoleDict()):
# Warning: only valid when group_id is candidate for indexation in a
# catalog_role column !
group_id_is_user = group_id in user_set
......@@ -239,7 +239,7 @@ class IndexableObjectWrapper(object):
group_allowed_set.add(prefix + ':' + role)
# sort and freeze `allowed` principals
for local_roles_group_id, allowed in allowed_by_local_roles_group_id.iteritems():
for local_roles_group_id, allowed in six.iteritems(allowed_by_local_roles_group_id):
allowed_by_local_roles_group_id[local_roles_group_id] = tuple(sorted(allowed))
self.__security_parameter_cache = result = (
......@@ -758,11 +758,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
)
query_list = []
append = query_list.append
for key, value in role_column_dict.iteritems():
for key, value in six.iteritems(role_column_dict):
append(SimpleQuery(**{key : value}))
if security_uid_dict:
catalog_security_uid_groups_columns_dict = self.getSQLCatalog().getSQLCatalogSecurityUidGroupsColumnsDict()
for local_roles_group_id, security_uid_list in security_uid_dict.iteritems():
for local_roles_group_id, security_uid_list in six.iteritems(security_uid_dict):
assert security_uid_list
append(SimpleQuery(
**{catalog_security_uid_groups_columns_dict[local_roles_group_id]: security_uid_list}
......@@ -941,7 +941,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security_uid_dict,
w.optimised_roles_and_users,
) = getSecurityUidDict(document_w)
for local_roles_group_id, security_uid in security_uid_dict.iteritems():
for local_roles_group_id, security_uid in six.iteritems(security_uid_dict):
catalog_column = catalog_security_uid_groups_columns_dict.get(
local_roles_group_id,
default_security_uid_column,
......@@ -1207,7 +1207,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
suffix = ('' if forward else '__related') + '__uid'
parent_document_set = base_category_dict.pop('parent', None)
query_list = []
for base_category_id, document_set in base_category_dict.iteritems():
for base_category_id, document_set in six.iteritems(base_category_dict):
column = prefix + base_category_id + suffix
category_query = SimpleQuery(**{
column: {document.getUid() for document in document_set},
......
......@@ -114,7 +114,7 @@ class FilterDict(object):
def __setitem__(self, key, item):
filter_ = self[key]
for k, v in item.iteritems():
for k, v in six.iteritems(item):
filter_[k] = v
def get(self, key, default=None):
......
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