[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 07 Jul 2010 10:46:33 +0200
changeset 5914 dc5a77a2e485
parent 5913 85240b3f9ee4
child 5915 e6cc50932720
[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
web/test/unittest_form.py
web/views/massmailing.py
--- a/web/test/unittest_form.py	Tue Jul 06 19:33:59 2010 +0200
+++ b/web/test/unittest_form.py	Wed Jul 07 10:46:33 2010 +0200
@@ -54,15 +54,15 @@
         t = self.req.create_entity('Tag', name=u'x')
         form1 = self.vreg['forms'].select('edition', self.req, entity=t)
         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
-        self.failUnless(b.eid in unrelated, unrelated)
+        self.failUnless(unicode(b.eid) in unrelated, unrelated)
         form2 = self.vreg['forms'].select('edition', self.req, entity=b)
         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
-        self.failUnless(t.eid in unrelated, unrelated)
+        self.failUnless(unicode(t.eid) in unrelated, unrelated)
         self.execute('SET X tags Y WHERE X is Tag, Y is BlogEntry')
         unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)]
-        self.failIf(b.eid in unrelated, unrelated)
+        self.failIf(unicode(b.eid) in unrelated, unrelated)
         unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)]
-        self.failIf(t.eid in unrelated, unrelated)
+        self.failIf(unicode(t.eid) in unrelated, unrelated)
 
 
     def test_form_field_vocabulary_new_entity(self):
--- a/web/views/massmailing.py	Tue Jul 06 19:33:59 2010 +0200
+++ b/web/views/massmailing.py	Wed Jul 07 10:46:33 2010 +0200
@@ -50,7 +50,7 @@
 
 
 def recipient_vocabulary(form, field):
-    vocab = [(entity.cw_adapt_to('IEmailable').get_email(), entity.eid)
+    vocab = [(entity.cw_adapt_to('IEmailable').get_email(), unicode(entity.eid))
              for entity in form.cw_rset.entities()]
     return [(label, value) for label, value in vocab if label]