process_rql now done in the controller tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 12 Mar 2009 16:32:01 +0100
branchtls-sprint
changeset 1092 b8fbb95dc0eb
parent 1091 b5e253c0dd13
child 1093 b4b09ae9058c
process_rql now done in the controller
web/controller.py
web/views/basecontrollers.py
web/views/embedding.py
--- a/web/controller.py	Thu Mar 12 16:29:00 2009 +0100
+++ b/web/controller.py	Thu Mar 12 16:32:01 2009 +0100
@@ -85,6 +85,17 @@
         raise NotImplementedError
 
     # generic methods useful for concret implementations ######################
+
+    def process_rql(self, rql):
+        """execute rql if specified"""
+        if rql:
+            self.ensure_ro_rql(rql)
+            if not isinstance(rql, unicode):
+                rql = unicode(rql, self.req.encoding)
+            pp = self.vreg.select_component('magicsearch', self.req)
+            self.rset = pp.process_query(rql, self.req)
+            return self.rset
+        return None
     
     def check_expected_params(self, params):
         """check that the given list of parameters are specified in the form
--- a/web/views/basecontrollers.py	Thu Mar 12 16:29:00 2009 +0100
+++ b/web/views/basecontrollers.py	Thu Mar 12 16:32:01 2009 +0100
@@ -99,17 +99,6 @@
             view = self.vreg.select_view(vid, req, rset)
         return view, rset
 
-    def process_rql(self, rql):
-        """execute rql if specified"""
-        if rql:
-            self.ensure_ro_rql(rql)
-            if not isinstance(rql, unicode):
-                rql = unicode(rql, self.req.encoding)
-            pp = self.vreg.select_component('magicsearch', self.req)
-            self.rset = pp.process_query(rql, self.req)
-            return self.rset
-        return None
-
     def add_to_breadcrumbs(self, view):
         # update breadcrumps **before** validating cache, unless the view
         # specifies explicitly it should not be added to breadcrumb or the
--- a/web/views/embedding.py	Thu Mar 12 16:29:00 2009 +0100
+++ b/web/views/embedding.py	Thu Mar 12 16:32:01 2009 +0100
@@ -33,7 +33,6 @@
     def call(self, body):
         # XXX fallback to HTML 4 mode when embeding ?
         self.set_request_content_type()
-        self.process_rql(self.req.form.get('rql'))
         self.req.search_state = ('normal',)
         self.template_header(self.content_type, None, self.req._('external page'),
                              [NOINDEX, NOFOLLOW])
@@ -72,7 +71,8 @@
             except HTTPError, err:
                 body = '<h2>%s</h2><h3>%s</h3>' % (
                     _('error while embedding page'), err)
-        return self.vreg.main_template(req, self.template, body=body)
+        self.process_rql(req.form.get('rql'))
+        return self.vreg.main_template(req, self.template, rset=self.rset, body=body)
 
 
 def entity_has_embedable_url(entity):