server/querier.py
changeset 6139 f76599a96238
parent 6129 fea746b60093
child 6142 8bc6eac1fac1
child 6361 843684a50e48
equal deleted inserted replaced
6102:27c47d239739 6139:f76599a96238
   420                 restricted_vars.update(localcheck)
   420                 restricted_vars.update(localcheck)
   421                 localchecks.setdefault(tuple(localcheck.iteritems()), []).append(solution)
   421                 localchecks.setdefault(tuple(localcheck.iteritems()), []).append(solution)
   422         # raise Unautorized exception if the user can't access to any solution
   422         # raise Unautorized exception if the user can't access to any solution
   423         if not newsolutions:
   423         if not newsolutions:
   424             raise Unauthorized('\n'.join(msgs))
   424             raise Unauthorized('\n'.join(msgs))
   425         rqlst.set_possible_types(newsolutions)
   425         if msgs:
       
   426             # (else solutions have not been modified)
       
   427             rqlst.set_possible_types(newsolutions)
   426         return localchecks, restricted_vars
   428         return localchecks, restricted_vars
   427 
   429 
   428     def finalize(self, select, solutions, insertedvars):
   430     def finalize(self, select, solutions, insertedvars):
   429         rqlst = Union()
   431         rqlst = Union()
   430         rqlst.append(select)
   432         rqlst.append(select)
   431         for mainvarname, rschema, newvarname in insertedvars:
   433         for mainvarname, rschema, newvarname in insertedvars:
   432             nvartype = str(rschema.objects(solutions[0][mainvarname])[0])
   434             nvartype = str(rschema.objects(solutions[0][mainvarname])[0])
   433             for sol in solutions:
   435             for sol in solutions:
   434                 sol[newvarname] = nvartype
   436                 sol[newvarname] = nvartype
   435         select.clean_solutions(solutions)
   437         select.clean_solutions(solutions)
       
   438         add_types_restriction(self.schema, select)
   436         self.rqlhelper.annotate(rqlst)
   439         self.rqlhelper.annotate(rqlst)
   437         self.preprocess(rqlst, security=False)
   440         self.preprocess(rqlst, security=False)
   438         return rqlst
   441         return rqlst
   439 
   442 
   440 
   443