equal
deleted
inserted
replaced
59 """return a description for a result set""" |
59 """return a description for a result set""" |
60 description = [] |
60 description = [] |
61 for term in selected: |
61 for term in selected: |
62 description.append(term.get_type(solution, args)) |
62 description.append(term.get_type(solution, args)) |
63 return description |
63 return description |
|
64 |
|
65 def selection_idx_type(i, rqlst, args): |
|
66 """try to return type of term at index `i` of the rqlst's selection""" |
|
67 for select in rqlst.children: |
|
68 term = select.selection[i] |
|
69 for solution in select.solutions: |
|
70 try: |
|
71 ttype = term.get_type(solution, args) |
|
72 if ttype is not None: |
|
73 return ttype |
|
74 except CoercionError: |
|
75 return None |
64 |
76 |
65 @objectify_selector |
77 @objectify_selector |
66 def is_user_session(cls, req, **kwargs): |
78 def is_user_session(cls, req, **kwargs): |
67 """repository side only selector returning 1 if the session is a regular |
79 """repository side only selector returning 1 if the session is a regular |
68 user session and not an internal session |
80 user session and not an internal session |
1155 # not so easy, looks for variable which changes from one solution |
1167 # not so easy, looks for variable which changes from one solution |
1156 # to another |
1168 # to another |
1157 unstables = rqlst.get_variable_indices() |
1169 unstables = rqlst.get_variable_indices() |
1158 basedescr = [] |
1170 basedescr = [] |
1159 todetermine = [] |
1171 todetermine = [] |
1160 sampleselect = rqlst.children[0] |
1172 for i in xrange(len(rqlst.children[0].selection)): |
1161 samplesols = sampleselect.solutions[0] |
1173 ttype = selection_idx_type(i, rqlst, args) |
1162 for i, term in enumerate(sampleselect.selection): |
1174 if ttype is None or ttype == 'Any': |
1163 try: |
|
1164 ttype = term.get_type(samplesols, args) |
|
1165 except CoercionError: |
|
1166 ttype = None |
1175 ttype = None |
1167 isfinal = True |
1176 isfinal = True |
1168 else: |
1177 else: |
1169 if ttype is None or ttype == 'Any': |
1178 isfinal = ttype in BASE_TYPES |
1170 ttype = None |
|
1171 isfinal = True |
|
1172 else: |
|
1173 isfinal = ttype in BASE_TYPES |
|
1174 if ttype is None or i in unstables: |
1179 if ttype is None or i in unstables: |
1175 basedescr.append(None) |
1180 basedescr.append(None) |
1176 todetermine.append( (i, isfinal) ) |
1181 todetermine.append( (i, isfinal) ) |
1177 else: |
1182 else: |
1178 basedescr.append(ttype) |
1183 basedescr.append(ttype) |