[forms] edited_entity must be set before calling session_key()
EntityFieldsForm.__init__ calls FieldsForm.__init__ which in turn
calls self.session_key().
self.session_key() uses self.edited_key to compute the correct session
key. We thus need edited_entity to be set **before** calling super's __init__.
The bug only occured when EntityFieldsForm was selected because of its
one_line_rset() selector instead of match_kwargs('entity').
from logilab.common.testlib import unittest_main
from cubicweb.devtools.apptest import EnvBasedTC
class PyViewsTC(EnvBasedTC):
def test_pyvaltable(self):
content = self.vreg['views'].render('pyvaltable', self.request(),
pyvalue=[[1, 'a'], [2, 'b']],
headers=['num', 'char'])
self.assertEquals(content.strip(), '''<table class="listing">
<tr><th>num</th><th>char</th></tr>
<tr><td>1</td><td>a</td></tr>
<tr><td>2</td><td>b</td></tr>
</table>''')
def test_pyvallist(self):
content = self.vreg['views'].render('pyvallist', self.request(),
pyvalue=[1, 'a'])
self.assertEquals(content.strip(), '''<ul>
<li>1</li>
<li>a</li>
</ul>''')
if __name__ == '__main__':
unittest_main()