equal
deleted
inserted
replaced
23 |
23 |
24 * brings these classes all together to provide a single access |
24 * brings these classes all together to provide a single access |
25 point to a cubicweb instance. |
25 point to a cubicweb instance. |
26 * handles session management |
26 * handles session management |
27 """ |
27 """ |
|
28 |
28 from __future__ import print_function |
29 from __future__ import print_function |
29 |
|
30 __docformat__ = "restructuredtext en" |
|
31 |
30 |
32 from warnings import warn |
31 from warnings import warn |
33 from itertools import chain |
32 from itertools import chain |
34 from time import time, localtime, strftime |
33 from time import time, localtime, strftime |
35 from contextlib import contextmanager |
34 from contextlib import contextmanager |
946 # and does not use setdefault on purpose. Unless a new release |
945 # and does not use setdefault on purpose. Unless a new release |
947 # of the Python interpreter advertises large perf improvements |
946 # of the Python interpreter advertises large perf improvements |
948 # in setdefault, this should not be changed without profiling. |
947 # in setdefault, this should not be changed without profiling. |
949 for eid in eids: |
948 for eid in eids: |
950 etype = self.type_from_eid(eid, cnx) |
949 etype = self.type_from_eid(eid, cnx) |
951 # XXX should cache entity's cw_metainformation |
|
952 entity = cnx.entity_from_eid(eid, etype) |
950 entity = cnx.entity_from_eid(eid, etype) |
953 try: |
951 try: |
954 data_by_etype[etype].append(entity) |
952 data_by_etype[etype].append(entity) |
955 except KeyError: |
953 except KeyError: |
956 data_by_etype[etype] = [entity] |
954 data_by_etype[etype] = [entity] |