def is_active_slide(self): """ Return True, if the the slide is the active slide. """ from openslides.projector.api import get_active_slide active_slide = get_active_slide() slide_pk = int_or_none(active_slide.get('pk', None)) return (active_slide['callback'] == self.slide_callback_name and self.pk == slide_pk)
def test_int_or_none(self): self.assertEqual(int_or_none('5'), 5) self.assertEqual(int_or_none(5), 5) self.assertIsNone(int_or_none('text')) self.assertIsNone(int_or_none(None))