backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Jun 2010 15:29:18 +0200
changeset 5633 879590c52679
parent 5628 56042c65d511 (current diff)
parent 5632 1e7c662bd6f8 (diff)
child 5636 8138d9c86ac8
backport stable
cwconfig.py
test/unittest_entity.py
web/views/tableview.py
--- a/cwconfig.py	Wed Jun 02 14:24:28 2010 +0200
+++ b/cwconfig.py	Wed Jun 02 15:29:18 2010 +0200
@@ -1154,7 +1154,7 @@
         def as_sql(self, backend, args):
             raise NotImplementedError('source only callback')
 
-        def source_execute(self, source, value):
+        def source_execute(self, source, session, value):
             fpath = source.binary_to_str(value)
             try:
                 return Binary(fpath)
--- a/server/sources/rql2sql.py	Wed Jun 02 14:24:28 2010 +0200
+++ b/server/sources/rql2sql.py	Wed Jun 02 15:29:18 2010 +0200
@@ -72,7 +72,7 @@
 FunctionDescr.update_cb_stack = default_update_cb_stack
 
 LENGTH = SQL_FUNCTIONS_REGISTRY.get_function('LENGTH')
-def length_source_execute(source, value):
+def length_source_execute(source, session, value):
     return len(value.getvalue())
 LENGTH.source_execute = length_source_execute
 
--- a/test/unittest_entity.py	Wed Jun 02 14:24:28 2010 +0200
+++ b/test/unittest_entity.py	Wed Jun 02 15:29:18 2010 +0200
@@ -356,8 +356,15 @@
                             data_encoding=u'ascii', data_name=u'toto.py')
         from cubicweb import mttransforms
         if mttransforms.HAS_PYGMENTS_TRANSFORMS:
-            self.assertEquals(e.printable_value('data'),
-                              '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
+            import pygments
+            if tuple(int(i) for i in pygments.__version__.split('.')[:2]) >= (1, 3):
+                self.assertEquals(e.printable_value('data'),
+                                  '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
+</pre></div>
+''')
+            else
+                self.assertEquals(e.printable_value('data'),
+                                  '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mf">1</span>
 </pre></div>
 ''')
         else:
--- a/web/views/tableview.py	Wed Jun 02 14:24:28 2010 +0200
+++ b/web/views/tableview.py	Wed Jun 02 15:29:18 2010 +0200
@@ -321,7 +321,7 @@
       displayed with default restrictions set
     """
     __regid__ = 'initialtable'
-    __select__ = nonempty_rset() & match_form_params('actualrql')
+    __select__ = nonempty_rset()
     # should not be displayed in possible view since it expects some specific
     # parameters
     title = None
@@ -329,8 +329,12 @@
     def call(self, title=None, subvid=None, headers=None, divid=None,
              displaycols=None, displayactions=None, mainindex=None):
         """Dumps a table displaying a composite query"""
-        actrql = self._cw.form['actualrql']
-        self._cw.ensure_ro_rql(actrql)
+        try:
+            actrql = self._cw.form['actualrql']
+        except KeyError:
+            actrql = self.cw_rset.printable_rql()
+        else:
+            self._cw.ensure_ro_rql(actrql)
         displaycols = self.displaycols(displaycols, headers)
         if displayactions is None and 'displayactions' in self._cw.form:
             displayactions = True