Пример #1
0
    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')
Пример #2
0
 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)]
Пример #3
0
    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)]
Пример #4
0
 def test_add(self):
     person = self.add_contact('BDFL')
     self.assertTrue(IContactPerson.providedBy(person))
     self.assertEqual(person.id, 'BDFL')