def test_add(self): with self.user('admin'): person = api.content.create( container=self.new_temporary_folder(), type='seantis.dir.contacts.contact', title='BDFL' ) self.assertTrue(IContactPerson.providedBy(person)) self.assertEqual(person.id, 'bdfl')
def contacts(self): children = (obj[1] for obj in self.context.contentItems()) is_contact = lambda child: IContactPerson.providedBy(child) return [c for c in children if is_contact(c)]
def contacts(self): children = (obj[1] for obj in self.context.contentItems()) is_contact = lambda child: IContactPerson.providedBy(child) is_visible = lambda child: checkPermission('zope2.View', child) return [c for c in children if is_contact(c) and is_visible(c)]
def test_add(self): person = self.add_contact('BDFL') self.assertTrue(IContactPerson.providedBy(person)) self.assertEqual(person.id, 'BDFL')