equal
deleted
inserted
replaced
66 node) |
66 node) |
67 """ |
67 """ |
68 try: |
68 try: |
69 return solution[term.name] |
69 return solution[term.name] |
70 except AttributeError: |
70 except AttributeError: |
71 return cnx.entity_metas(term.eval(args))['type'] |
71 return cnx.entity_type(term.eval(args)) |
72 |
72 |
73 def check_relations_read_access(cnx, select, args): |
73 def check_relations_read_access(cnx, select, args): |
74 """Raise :exc:`Unauthorized` if the given user doesn't have credentials to |
74 """Raise :exc:`Unauthorized` if the given user doesn't have credentials to |
75 read relations used in the given syntax tree |
75 read relations used in the given syntax tree |
76 """ |
76 """ |
680 return RepeatList(len(result), tuple(basedescr)) |
680 return RepeatList(len(result), tuple(basedescr)) |
681 return _build_descr(cnx, result, basedescr, todetermine) |
681 return _build_descr(cnx, result, basedescr, todetermine) |
682 |
682 |
683 def _build_descr(cnx, result, basedescription, todetermine): |
683 def _build_descr(cnx, result, basedescription, todetermine): |
684 description = [] |
684 description = [] |
685 entity_metas = cnx.entity_metas |
685 entity_type = cnx.entity_type |
686 todel = [] |
686 todel = [] |
687 for i, row in enumerate(result): |
687 for i, row in enumerate(result): |
688 row_descr = basedescription[:] |
688 row_descr = basedescription[:] |
689 for index, isfinal in todetermine: |
689 for index, isfinal in todetermine: |
690 value = row[index] |
690 value = row[index] |
694 continue |
694 continue |
695 if isfinal: |
695 if isfinal: |
696 row_descr[index] = etype_from_pyobj(value) |
696 row_descr[index] = etype_from_pyobj(value) |
697 else: |
697 else: |
698 try: |
698 try: |
699 row_descr[index] = entity_metas(value)['type'] |
699 row_descr[index] = entity_type(value) |
700 except UnknownEid: |
700 except UnknownEid: |
701 cnx.error('wrong eid %s in repository, you should ' |
701 cnx.error('wrong eid %s in repository, you should ' |
702 'db-check the database' % value) |
702 'db-check the database' % value) |
703 todel.append(i) |
703 todel.append(i) |
704 break |
704 break |