# HG changeset patch # User Aurelien Campeas # Date 1429130900 -7200 # Node ID 33e44293b0eb24e2e883e015c9f1e7b5db445e38 # Parent 7e311ee8b5b0e9b5245e98ced68cbf571b07aa4f [entities] fix dc_title output for bool(value) == False Closes #5194853. diff -r 7e311ee8b5b0 -r 33e44293b0eb entities/__init__.py --- a/entities/__init__.py Fri May 15 18:06:03 2015 +0200 +++ b/entities/__init__.py Wed Apr 15 22:48:20 2015 +0200 @@ -68,7 +68,7 @@ if rschema.meta: continue value = self.cw_attr_value(rschema.type) - if value: + if value is not None: # make the value printable (dates, floats, bytes, etc.) return self.printable_value(rschema.type, value, attrschema.type, format='text/plain') diff -r 7e311ee8b5b0 -r 33e44293b0eb entities/test/data/schema.py --- a/entities/test/data/schema.py Fri May 15 18:06:03 2015 +0200 +++ b/entities/test/data/schema.py Wed Apr 15 22:48:20 2015 +0200 @@ -17,10 +17,11 @@ # with CubicWeb. If not, see . """entities tests schema""" -from yams.buildobjs import EntityType, String, RichString +from yams.buildobjs import EntityType, String, RichString, Int from cubicweb.schema import make_workflowable class Company(EntityType): + order = Int() name = String() description = RichString() diff -r 7e311ee8b5b0 -r 33e44293b0eb entities/test/unittest_base.py --- a/entities/test/unittest_base.py Fri May 15 18:06:03 2015 +0200 +++ b/entities/test/unittest_base.py Wed Apr 15 22:48:20 2015 +0200 @@ -137,6 +137,12 @@ self.assertEqual(e.dc_title(), 'member') self.assertEqual(e.name(), u'bouah lôt') + def test_falsey_dc_title(self): + with self.admin_access.repo_cnx() as cnx: + e = cnx.create_entity('Company', order=0, name=u'pythonian') + cnx.commit() + self.assertEqual(u'0', e.dc_title()) + def test_allowed_massmail_keys(self): with self.admin_access.repo_cnx() as cnx: e = cnx.execute('CWUser U WHERE U login "member"').get_entity(0, 0)