equal
deleted
inserted
replaced
268 possible type). If cachekey is given, the query necessary to fetch the |
268 possible type). If cachekey is given, the query necessary to fetch the |
269 results (but not the results themselves) may be cached using this key. |
269 results (but not the results themselves) may be cached using this key. |
270 """ |
270 """ |
271 if not args is None: |
271 if not args is None: |
272 args = args.copy() |
272 args = args.copy() |
273 if server.DEBUG: |
273 if server.DEBUG & server.DBG_RQL: |
274 print 'RQL FOR PYRO SOURCE', self.uri |
274 print 'RQL FOR PYRO SOURCE %s: %s', self.uri, union.as_string() |
275 print union.as_string() |
275 if args: |
276 if args: print 'ARGS', args |
276 print 'ARGS', args |
277 print 'SOLUTIONS', ','.join(str(s.solutions) for s in union.children) |
277 if server.DEBUG & server.DBG_MORE: |
|
278 print 'SOLUTIONS', ','.join(str(s.solutions) for s in union.children) |
278 # get cached cursor anyway |
279 # get cached cursor anyway |
279 cu = session.pool[self.uri] |
280 cu = session.pool[self.uri] |
280 if cu is None: |
281 if cu is None: |
281 # this is a ConnectionWrapper instance |
282 # this is a ConnectionWrapper instance |
282 msg = session._("can't connect to source %s, some data may be missing") |
283 msg = session._("can't connect to source %s, some data may be missing") |
286 rql, cachekey = RQL2RQL(self).generate(session, union, args) |
287 rql, cachekey = RQL2RQL(self).generate(session, union, args) |
287 except UnknownEid, ex: |
288 except UnknownEid, ex: |
288 if server.DEBUG: |
289 if server.DEBUG: |
289 print 'unknown eid', ex, 'no results' |
290 print 'unknown eid', ex, 'no results' |
290 return [] |
291 return [] |
291 if server.DEBUG: |
292 if server.DEBUG & server.DBG_RQL: |
292 print 'TRANSLATED RQL', rql |
293 print 'TRANSLATED RQL', rql |
293 try: |
294 try: |
294 rset = cu.execute(rql, args, cachekey) |
295 rset = cu.execute(rql, args, cachekey) |
295 except Exception, ex: |
296 except Exception, ex: |
296 self.exception(str(ex)) |
297 self.exception(str(ex)) |
323 del descr[rowindex] |
324 del descr[rowindex] |
324 break |
325 break |
325 results = rows |
326 results = rows |
326 else: |
327 else: |
327 results = [] |
328 results = [] |
328 if server.DEBUG: |
329 if server.DEBUG & server.DBG_RQL: |
329 if len(results)>10: |
330 if len(results)>10: |
330 print '--------------->', results[:10], '...', len(results) |
331 print '-->', results[:10], '...', len(results) |
331 else: |
332 else: |
332 print '--------------->', results |
333 print '-->', results |
333 return results |
334 return results |
334 |
335 |
335 def _entity_relations_and_kwargs(self, session, entity): |
336 def _entity_relations_and_kwargs(self, session, entity): |
336 relations = [] |
337 relations = [] |
337 kwargs = {'x': self.eid2extid(entity.eid, session)} |
338 kwargs = {'x': self.eid2extid(entity.eid, session)} |