def index(request, event_type=None, sub_call=None): panels = site.get_panels() if event_type: try: panel = site.get_panel(event_type) except exceptions.PanelDoesNotExist: raise Http404 else: panel = site.get_panel(panels[0]['type']) try: return panel.get_response(request, sub_call) except exceptions.PanelMethodDoesNotExist: raise Http404
def seed_data(count=10000): from tapz.site import site panel = site.get_panel('errors') for x in xrange(count-1): if x % 100 == 0: sys.stdout.write('.') sys.stdout.flush() data = generate_data() panel.add_event(data) data = generate_data() data['timestamp'] = int(time.time()) panel.add_event(data)
def test_get_panel_by_type(self): self.assert_(isinstance(site.get_panel('testpanel'), TestPanel)) self.assert_(isinstance(site.get_panel('ev_type'), TestPanelWithMeta))
def add_event(event_type, info): panel = site.get_panel(event_type).add_event(info)