equal
deleted
inserted
replaced
84 except KeyError: |
84 except KeyError: |
85 pass # If no translation found, leave the relation type as is |
85 pass # If no translation found, leave the relation type as is |
86 else: |
86 else: |
87 # Only one possible translation, no ambiguity |
87 # Only one possible translation, no ambiguity |
88 if len(translation_set) == 1: |
88 if len(translation_set) == 1: |
89 relation.r_type = iter(translations[rtype]).next() |
89 relation.r_type = next(iter(translations[rtype])) |
90 # More than 1 possible translation => resolve it later |
90 # More than 1 possible translation => resolve it later |
91 else: |
91 else: |
92 ambiguous_nodes[relation] = (lhs.name, translation_set) |
92 ambiguous_nodes[relation] = (lhs.name, translation_set) |
93 if ambiguous_nodes: |
93 if ambiguous_nodes: |
94 resolve_ambiguities(vartypes, ambiguous_nodes, schema) |
94 resolve_ambiguities(vartypes, ambiguous_nodes, schema) |
587 ``dest_var`` will be picked among availabel variables if types match, |
587 ``dest_var`` will be picked among availabel variables if types match, |
588 otherwise a new one will be created. |
588 otherwise a new one will be created. |
589 """ |
589 """ |
590 schema = self._cw.vreg.schema |
590 schema = self._cw.vreg.schema |
591 relations = set() |
591 relations = set() |
592 untyped_dest_var = rqlvar_maker(defined=select.defined_vars).next() |
592 untyped_dest_var = next(rqlvar_maker(defined=select.defined_vars)) |
593 # for each solution |
593 # for each solution |
594 # 1. find each possible relation |
594 # 1. find each possible relation |
595 # 2. for each relation: |
595 # 2. for each relation: |
596 # 2.1. if the relation is meta, skip it |
596 # 2.1. if the relation is meta, skip it |
597 # 2.2. for each possible destination type, pick up possible |
597 # 2.2. for each possible destination type, pick up possible |