equal
deleted
inserted
replaced
27 |
27 |
28 from logilab.common.decorators import cached |
28 from logilab.common.decorators import cached |
29 from logilab.common.deprecation import deprecated |
29 from logilab.common.deprecation import deprecated |
30 from logilab.common.date import ustrftime, strptime, todate, todatetime |
30 from logilab.common.date import ustrftime, strptime, todate, todatetime |
31 |
31 |
32 from cubicweb import Unauthorized, NoSelectableObject, typed_eid, uilib |
32 from cubicweb import Unauthorized, NoSelectableObject, uilib |
33 from cubicweb.rset import ResultSet |
33 from cubicweb.rset import ResultSet |
34 |
34 |
35 ONESECOND = timedelta(0, 1, 0) |
35 ONESECOND = timedelta(0, 1, 0) |
36 CACHE_REGISTRY = {} |
36 CACHE_REGISTRY = {} |
37 |
37 |
112 def eid_rset(self, eid, etype=None): |
112 def eid_rset(self, eid, etype=None): |
113 """return a result set for the given eid without doing actual query |
113 """return a result set for the given eid without doing actual query |
114 (we have the eid, we can suppose it exists and user has access to the |
114 (we have the eid, we can suppose it exists and user has access to the |
115 entity) |
115 entity) |
116 """ |
116 """ |
117 eid = typed_eid(eid) |
117 eid = int(eid) |
118 if etype is None: |
118 if etype is None: |
119 etype = self.describe(eid)[0] |
119 etype = self.describe(eid)[0] |
120 rset = ResultSet([(eid,)], 'Any X WHERE X eid %(x)s', {'x': eid}, |
120 rset = ResultSet([(eid,)], 'Any X WHERE X eid %(x)s', {'x': eid}, |
121 [(etype,)]) |
121 [(etype,)]) |
122 rset.req = self |
122 rset.req = self |