server/session.py
changeset 746 1babfaa026bb
parent 716 03ffbe9c5183
child 940 15dcdc863965
child 974 3ec0a7bd87ae
equal deleted inserted replaced
716:03ffbe9c5183 746:1babfaa026bb
    58     description = []
    58     description = []
    59     for term in selected:
    59     for term in selected:
    60         description.append(term.get_type(solution, args))
    60         description.append(term.get_type(solution, args))
    61     return description
    61     return description
    62 
    62 
    63 #XXX rql <= 0.18.3 bw compat
       
    64 from rql import stmts
    63 from rql import stmts
    65 if not hasattr(stmts.Union, 'get_variable_variables'):
    64 assert hasattr(stmts.Union, 'get_variable_variables'), "You need RQL > 0.18.3"
    66     def _union_get_variable_variables(self):
       
    67         """return the set of variable names which take different type according to
       
    68         the solution
       
    69         """
       
    70         change = set()
       
    71         values = {}
       
    72         for select in self.children:
       
    73             change.update(select.get_variable_variables(values))
       
    74         return change
       
    75     stmts.Union.get_variable_variables = _union_get_variable_variables
       
    76                         
       
    77     def _select_get_variable_variables(self, _values=None):
       
    78         """return the set of variable names which take different type according to
       
    79         the solution
       
    80         """
       
    81         change = set()
       
    82         if _values is None:
       
    83             _values = {}
       
    84         for solution in self.solutions:
       
    85             for vname, etype in solution.iteritems():
       
    86                 if not vname in _values:
       
    87                     _values[vname] = etype
       
    88                 elif _values[vname] != etype:
       
    89                     change.add(vname)
       
    90         return change
       
    91     stmts.Select.get_variable_variables = _select_get_variable_variables
       
    92 
    65 
    93 class Session(RequestSessionMixIn):
    66 class Session(RequestSessionMixIn):
    94     """tie session id, user, connections pool and other session data all
    67     """tie session id, user, connections pool and other session data all
    95     together
    68     together
    96     """
    69     """