server/rqlannotation.py
branchstable
changeset 7041 5a6fd60f7617
parent 6940 1172c25655b7
child 7193 7eaef037ea9d
equal deleted inserted replaced
7039:df0e8581b06f 7041:5a6fd60f7617
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
   133             # we have to select a kindof "main" relation which will "extrajoins"
   133             # we have to select a kindof "main" relation which will "extrajoins"
   134             # the other
   134             # the other
   135             # priority should be given to relation which are not in inner queries
   135             # priority should be given to relation which are not in inner queries
   136             # (eg exists)
   136             # (eg exists)
   137             try:
   137             try:
   138                 stinfo['principal'] = _select_principal(var.scope, joins)
   138                 stinfo['principal'] = principal = _select_principal(var.scope, joins)
       
   139                 if getrschema(principal.r_type).inlined:
       
   140                     # the scope of the lhs variable must be equal or outer to the
       
   141                     # rhs variable's scope (since it's retrieved from lhs's table)
       
   142                     sstinfo = principal.children[0].variable.stinfo
       
   143                     sstinfo['scope'] = common_parent(sstinfo['scope'], stinfo['scope']).scope
   139             except CantSelectPrincipal:
   144             except CantSelectPrincipal:
   140                 stinfo['invariant'] = False
   145                 stinfo['invariant'] = False
   141     rqlst.need_distinct = need_distinct
   146     rqlst.need_distinct = need_distinct
   142     return has_text_query
   147     return has_text_query
   143 
   148