Commit 41def8d9 authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[py3k] dict.itervalues → dict.values

parent 10942ed172de
......@@ -492,7 +492,7 @@ class CWRegistryStore(RegistryStore):
"""
self.schema = schema
for registry, regcontent in self.items():
for objects in regcontent.itervalues():
for objects in regcontent.values():
for obj in objects:
obj.schema = schema
......@@ -543,7 +543,7 @@ class CWRegistryStore(RegistryStore):
self.unregister(obj)
super(CWRegistryStore, self).initialization_completed()
if 'uicfg' in self: # 'uicfg' is not loaded in a pure repository mode
for rtags in self['uicfg'].itervalues():
for rtags in self['uicfg'].values():
for rtag in rtags:
# don't check rtags if we don't want to cleanup_unused_appobjects
rtag.init(self.schema, check=self.config.cleanup_unused_appobjects)
......
......@@ -424,7 +424,7 @@ class CWImportController(object):
self.tell(pformat(sorted(error[1])))
def _print_stats(self):
nberrors = sum(len(err) for err in self.errors.itervalues())
nberrors = sum(len(err) for err in self.errors.values())
self.tell('\nImport statistics: %i entities, %i types, %i relations and %i errors'
% (self.store.nb_inserted_entities,
self.store.nb_inserted_types,
......
......@@ -251,7 +251,7 @@ def _generate_schema_pot(w, vreg, schema, libconfig=None):
# bw compat, necessary until all translation of relation are
# done properly...
add_msg(w, '%s_object' % rtype)
for rdef in rschema.rdefs.itervalues():
for rdef in rschema.rdefs.values():
if not rdef.description or rdef.description in done:
continue
if (librschema is None or
......@@ -268,7 +268,7 @@ def _iter_vreg_objids(vreg, done):
for reg, objdict in vreg.items():
if reg in ('boxes', 'contentnavigation'):
continue
for objects in objdict.itervalues():
for objects in objdict.values():
for obj in objects:
objid = '%s_%s' % (reg, obj.__regid__)
if objid in done:
......
......@@ -116,7 +116,7 @@ def schema_eids_idx(schema):
schema_eids[x] = x.eid
for x in schema.relations():
schema_eids[x] = x.eid
for rdef in x.rdefs.itervalues():
for rdef in x.rdefs.values():
schema_eids[(rdef.subject, rdef.rtype, rdef.object)] = rdef.eid
return schema_eids
......@@ -128,7 +128,7 @@ def restore_schema_eids_idx(schema, schema_eids):
for x in schema.relations():
x.eid = schema_eids[x]
schema._eid_index[x.eid] = x
for rdef in x.rdefs.itervalues():
for rdef in x.rdefs.values():
rdef.eid = schema_eids[(rdef.subject, rdef.rtype, rdef.object)]
schema._eid_index[rdef.eid] = rdef
......
......@@ -1294,7 +1294,7 @@ def not_selected(vreg, appobject):
# # XXX broken
# from cubicweb.devtools.apptest import TestEnvironment
# env = testclass._env = TestEnvironment('data', configcls=testclass.configcls)
# for reg in env.vreg.itervalues():
# for reg in env.vreg.values():
# reg._selected = {}
# try:
# orig_select_best = reg.__class__.__orig_select_best
......@@ -1317,7 +1317,7 @@ def not_selected(vreg, appobject):
# for regname, reg in testclass._env.vreg.items():
# if regname in skipregs:
# continue
# for appobjects in reg.itervalues():
# for appobjects in reg.values():
# for appobject in appobjects:
# if not reg._selected.get(appobject):
# print 'not tested', regname, appobject
......@@ -97,4 +97,4 @@ def entities_from_rdf(filename, etypes):
entities[subj]['relations'].setdefault(MAPPING_RELS[rel], set())
entities[subj]['relations'][MAPPING_RELS[rel]].add(unicode(obj))
return ((ent.get('attributes'), ent.get('relations'))
for ent in entities.itervalues())
for ent in entities.values())
......@@ -107,7 +107,7 @@ class WorkflowTC(CubicWebTC):
def setup_database(self):
rschema = self.schema['in_state']
for rdef in rschema.rdefs.itervalues():
for rdef in rschema.rdefs.values():
self.assertEqual(rdef.cardinality, '1*')
with self.admin_access.client_cnx() as cnx:
self.member_eid = self.create_user(cnx, 'member').eid
......
......@@ -208,7 +208,7 @@ class MemSchemaNotifyChanges(hook.SingleLastOperation):
repo.set_schema(repo.schema)
# CWUser class might have changed, update current session users
cwuser_cls = self.cnx.vreg['etypes'].etype_class('CWUser')
for session in repo._sessions.itervalues():
for session in repo._sessions.values():
session.user.__class__ = cwuser_cls
except Exception:
self.critical('error while setting schema', exc_info=True)
......
......@@ -26,7 +26,7 @@ from cubicweb.server import hook
def get_user_sessions(repo, ueid):
for session in repo._sessions.itervalues():
for session in repo._sessions.values():
if ueid == session.user.eid:
yield session
......
......@@ -299,7 +299,7 @@ elif applcubicwebversion < (3, 6, 0) and cubicwebversion >= (3, 6, 0):
with hooks_control(session, session.HOOKS_ALLOW_ALL, 'integrity'):
for rschema in repo.schema.relations():
rpermsdict = permsdict.get(rschema.eid, {})
for rdef in rschema.rdefs.itervalues():
for rdef in rschema.rdefs.values():
for action in rdef.ACTIONS:
actperms = []
for something in rpermsdict.get(action == 'update' and 'add' or action, ()):
......
......@@ -74,7 +74,7 @@ for entity in rql('Any X WHERE X cw_source S, S eid %(s)s', {'s': source.eid}).e
# only cleanup entities table, remaining stuff should be cleaned by a c-c
# db-check to be run after this script
for entities in todelete.itervalues():
for entities in todelete.values():
system_source.delete_info_multi(session, entities, source_name)
......@@ -87,7 +87,7 @@ for mappart in rql('Any X,SCH WHERE X cw_schema SCH, X cw_for_source S, S eid %(
if schemaent.cw_etype != 'CWEType':
assert schemaent.cw_etype == 'CWRType'
sch = schema._eid_index[schemaent.eid]
for rdef in sch.rdefs.itervalues():
for rdef in sch.rdefs.values():
if not source.support_entity(rdef.subject) \
or not source.support_entity(rdef.object):
continue
......
......@@ -17,7 +17,7 @@ def turn_function_to_class(node):
def cubicweb_transform(module):
# handle objectify_predicate decorator (and its former name until bw compat
# is kept). Only look at module level functions, should be enough.
for assnodes in module.locals.itervalues():
for assnodes in module.locals.values():
for node in assnodes:
if isinstance(node, scoped_nodes.Function) and node.decorators:
for decorator in node.decorators.nodes:
......
......@@ -281,7 +281,7 @@ class RQLExpression(object):
def transform_has_permission(self):
found = None
rqlst = self.rqlst
for var in rqlst.defined_vars.itervalues():
for var in rqlst.defined_vars.values():
for varref in var.references():
rel = varref.relation()
if rel is None:
......@@ -532,7 +532,7 @@ def order_eschemas(eschemas):
if not deps:
eschemas.append(eschema)
del graph[eschema]
for deps in graph.itervalues():
for deps in graph.values():
try:
deps.remove(eschema)
except KeyError:
......@@ -773,7 +773,7 @@ class CubicWebEntitySchema(EntitySchema):
def check_permission_definitions(self):
super(CubicWebEntitySchema, self).check_permission_definitions()
for groups in self.permissions.itervalues():
for groups in self.permissions.values():
for group_or_rqlexpr in groups:
if isinstance(group_or_rqlexpr, RRQLExpression):
msg = "can't use RRQLExpression on %s, use an ERQLExpression"
......@@ -916,7 +916,7 @@ class CubicWebRelationSchema(PermissionMixIn, RelationSchema):
if rdef.may_have_permission(action, req):
return True
else:
for rdef in self.rdefs.itervalues():
for rdef in self.rdefs.values():
if rdef.may_have_permission(action, req):
return True
return False
......@@ -958,7 +958,7 @@ class CubicWebRelationSchema(PermissionMixIn, RelationSchema):
if not rdef.has_perm(_cw, action, **kwargs):
return False
else:
for rdef in self.rdefs.itervalues():
for rdef in self.rdefs.values():
if not rdef.has_perm(_cw, action, **kwargs):
return False
return True
......@@ -1081,7 +1081,7 @@ class CubicWebSchema(Schema):
def iter_computed_attributes(self):
for relation in self.relations():
for rdef in relation.rdefs.itervalues():
for rdef in relation.rdefs.values():
if rdef.final and rdef.formula is not None:
yield rdef
......
......@@ -319,7 +319,7 @@ def check_mandatory_relations(schema, cnx, eids, fix=1):
continue
smandatory = set()
omandatory = set()
for rdef in rschema.rdefs.itervalues():
for rdef in rschema.rdefs.values():
if rdef.cardinality[0] in '1+':
smandatory.add(rdef.subject)
if rdef.cardinality[1] in '1+':
......@@ -347,7 +347,7 @@ def check_mandatory_attributes(schema, cnx, eids, fix=1):
for rschema in schema.relations():
if not rschema.final or rschema in VIRTUAL_RTYPES:
continue
for rdef in rschema.rdefs.itervalues():
for rdef in rschema.rdefs.values():
if rdef.cardinality[0] in '1+':
rql = 'Any X WHERE X %s NULL, X is %s, X cw_source S, S name "system"' % (
rschema, rdef.subject)
......
......@@ -391,7 +391,7 @@ class HooksRegistry(CWRegistry):
def filtered_possible_objects(self, pruned, *args, **kwargs):
for appobjects in self.itervalues():
for appobjects in self.values():
if pruned:
filtered_objects = [obj for obj in appobjects if obj not in pruned]
if not filtered_objects:
......
......@@ -420,7 +420,7 @@ class ServerMigrationHelper(MigrationHelper):
{'x': expreid}, ask_confirm=False)
else:
newexprs.pop(expression)
for expression in newexprs.itervalues():
for expression in newexprs.values():
expr = expression.expression
if not confirm or self.confirm('Add %s expression for %s permission of %s?'
% (expr, action, erschema)):
......
......@@ -270,7 +270,7 @@ class ExecutionPlan(object):
# which have a known eid
varkwargs = {}
if not cnx.transaction_data.get('security-rqlst-cache'):
for var in rqlst.defined_vars.itervalues():
for var in rqlst.defined_vars.values():
if var.stinfo['constnode'] is not None:
eid = var.stinfo['constnode'].eval(self.args)
varkwargs[var.name] = int(eid)
......@@ -419,7 +419,7 @@ class InsertPlan(ExecutionPlan):
def relation_defs(self):
"""return the list for relation definitions to insert"""
for rdefs in self._expanded_r_defs.itervalues():
for rdefs in self._expanded_r_defs.values():
for rdef in rdefs:
yield rdef
for rdef in self.r_defs:
......@@ -473,7 +473,7 @@ class InsertPlan(ExecutionPlan):
else:
relations[rtype] = [(subj, obj)]
repo.glob_add_relations(cnx, relations)
for edited in edited_entities.itervalues():
for edited in edited_entities.values():
repo.glob_update_entity(cnx, edited)
......
......@@ -193,7 +193,7 @@ class Repository(object):
# changed. So any existing user object have a different class than
# the new loaded one. We are hot fixing this.
usercls = self.vreg['etypes'].etype_class('CWUser')
for session in self._sessions.itervalues():
for session in self._sessions.values():
if not isinstance(session.user, InternalManager):
session.user.__class__ = usercls
......@@ -311,7 +311,7 @@ class Repository(object):
else:
self.vreg._set_schema(schema)
self.querier.set_schema(schema)
for source in self.sources_by_uri.itervalues():
for source in self.sources_by_uri.values():
source.set_schema(schema)
self.schema = schema
......@@ -437,7 +437,7 @@ class Repository(object):
"""
# iter on sources_by_uri then check enabled source since sources doesn't
# contain copy based sources
for source in self.sources_by_uri.itervalues():
for source in self.sources_by_uri.values():
if self.config.source_enabled(source) and source.support_entity('CWUser'):
try:
return source.authenticate(cnx, login, **authinfo)
......
......@@ -34,7 +34,7 @@ def _annotate_select(annotator, rqlst):
#if server.DEBUG:
# print '-------- sql annotate', repr(rqlst)
getrschema = annotator.schema.rschema
for var in rqlst.defined_vars.itervalues():
for var in rqlst.defined_vars.values():
stinfo = var.stinfo
if stinfo.get('ftirels'):
has_text_query = True
......@@ -145,7 +145,7 @@ def _annotate_select(annotator, rqlst):
stinfo['invariant'] = False
# see unittest_rqlannotation. test_has_text_security_cache_bug
# XXX probably more to do, but yet that work without more...
for col_alias in rqlst.aliases.itervalues():
for col_alias in rqlst.aliases.values():
if col_alias.stinfo.get('ftirels'):
has_text_query = True
return has_text_query
......@@ -232,7 +232,7 @@ def set_qdata(getrschema, union, noinvariant):
for select in union.children:
for subquery in select.with_:
set_qdata(getrschema, subquery.query, noinvariant)
for var in select.defined_vars.itervalues():
for var in select.defined_vars.values():
if var.stinfo['invariant']:
if var in noinvariant and not var.stinfo['principal'].r_type == 'has_text':
var._q_invariant = False
......
......@@ -284,7 +284,7 @@ def deserialize_schema(schema, cnx):
else:
rtype = str(rel)
relations[1].append(rtype)
for eschema, unique_together in unique_togethers.itervalues():
for eschema, unique_together in unique_togethers.values():
eschema._unique_together.append(tuple(sorted(unique_together)))
schema.infer_specialization_rules()
cnx.commit()
......@@ -387,7 +387,7 @@ def serialize_schema(cnx, schema):
rdefs = [rdef for k, rdef in rschema.rdefs.items()
if (rdef.subject, rdef.object) == k]
else:
rdefs = rschema.rdefs.itervalues()
rdefs = rschema.rdefs.values()
for rdef in rdefs:
execschemarql(execute, rdef,
rdef2rql(rdef, cstrtypemap, groupmap))
......@@ -512,7 +512,7 @@ def rschema2rql(rschema, cstrtypemap=None, addrdef=True, groupmap=None):
if addrdef:
assert cstrtypemap
# sort for testing purpose
for rdef in sorted(rschema.rdefs.itervalues(),
for rdef in sorted(rschema.rdefs.values(),
key=lambda x: (x.subject, x.object)):
for rql, values in rdef2rql(rdef, cstrtypemap, groupmap):
yield rql, values
......
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