[querier] improve 'Password selection not allowed' error message stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 03 Apr 2013 10:55:56 +0200
branchstable
changeset 8863 98c107bd6cd0
parent 8862 8011ca5d2841
child 8866 64f24ecad177
[querier] improve 'Password selection not allowed' error message to report the involved variable name whose type is Password, it usually help understanding the problem.
server/querier.py
--- a/server/querier.py	Wed Apr 03 11:09:50 2013 +0200
+++ b/server/querier.py	Wed Apr 03 10:55:56 2013 +0200
@@ -63,8 +63,9 @@
 def check_no_password_selected(rqlst):
     """check that Password entities are not selected"""
     for solution in rqlst.solutions:
-        if 'Password' in solution.itervalues():
-            raise Unauthorized('Password selection is not allowed')
+        for var, etype in solution.iteritems():
+            if etype == 'Password':
+                raise Unauthorized('Password selection is not allowed (%s)' % var)
 
 def term_etype(session, term, solution, args):
     """return the entity type for the given term (a VariableRef or a Constant