querier: Improve error message when ERQLExpression fails on some entity (closes #2267081) stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 21 Mar 2012 18:33:12 +0100
branchstable
changeset 8333 baa3ea5eac2b
parent 8332 e7c008ebef74
child 8334 20e38436395f
querier: Improve error message when ERQLExpression fails on some entity (closes #2267081) When an RQL variable is indeed "constant" (we know it's eid) ERQL expression are not inserted but checked prior query execution. If the session have no read access to the entity an `Unauthorized` exception is raised. This changeset add a meaningfull message to this exception:: No read acces on "X" with eid 42.
server/querier.py
--- a/server/querier.py	Mon Mar 26 12:13:40 2012 +0200
+++ b/server/querier.py	Wed Mar 21 18:33:12 2012 +0100
@@ -417,7 +417,7 @@
                         if rqlexpr.check(session, eid):
                             break
                     else:
-                        raise Unauthorized()
+                        raise Unauthorized('No read acces on %r with eid %i.' % (var, eid))
                 restricted_vars.update(localcheck)
                 localchecks.setdefault(tuple(localcheck.iteritems()), []).append(solution)
         # raise Unautorized exception if the user can't access to any solution