web/views/magicsearch.py
changeset 8510 e2913c9880a0
parent 8505 dcd9bc1d1bca
child 8695 358d8bed9626
equal deleted inserted replaced
8509:e83b4a64ba29 8510:e2913c9880a0
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2012 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
   450                 restrictions, incomplete_part = restrictions.rsplit(',', 1)
   450                 restrictions, incomplete_part = restrictions.rsplit(',', 1)
   451                 user_rql = '%s WHERE %s' % (variables, restrictions)
   451                 user_rql = '%s WHERE %s' % (variables, restrictions)
   452             else:
   452             else:
   453                 restrictions, incomplete_part = '', restrictions
   453                 restrictions, incomplete_part = '', restrictions
   454                 user_rql = variables
   454                 user_rql = variables
   455             select = parse(user_rql).children[0]
   455             select = parse(user_rql, print_errors=False).children[0]
   456             req.vreg.rqlhelper.annotate(select)
   456             req.vreg.rqlhelper.annotate(select)
   457             req.vreg.solutions(req, select, {})
   457             req.vreg.solutions(req, select, {})
   458             if restrictions:
   458             if restrictions:
   459                 return ['%s, %s' % (user_rql, suggestion)
   459                 return ['%s, %s' % (user_rql, suggestion)
   460                         for suggestion in self.rql_build_suggestions(select, incomplete_part)]
   460                         for suggestion in self.rql_build_suggestions(select, incomplete_part)]