[pyramid] EntityResource.rset : not exiting entity partially cached
In EntityResource.rset catches TypeResolverException and raise a HTTPNotFound error. Shouldn't it raise a HTTPNotFound if the rest is empty as well?
@reify
def rset(self):
if self.cls is None:
return self.request.cw_cnx.execute(
"Any X WHERE X eid %(x)s", {"x": int(self.value)}
)
st = self.cls.fetch_rqlst(self.request.cw_cnx.user, ordermethod=None)
st.add_constant_restriction(
st.get_variable("X"), self.attrname, "x", "Substitute"
)
if self.attrname == "eid":
try:
rset = self.request.cw_cnx.execute(
st.as_string(), {"x": int(self.value)}
)
except (ValueError, TypeResolverException):
# conflicting eid/type
raise HTTPNotFound()
else:
rset = self.request.cw_cnx.execute(st.as_string(), {"x": self.value})
return rset