def generate_page(): try: d = shelve.open('pagerduty.db') if ('full_listing' not in d or (time.time() - d['full_listing']['last_pulled']) > cache_timeout): # Pull full_schedule global secondary primary = pagerduty.get_user_schedule() if secondary: secondary = pagerduty.get_user_schedule(secondary) # Save pulled information packaged_dict = {} packaged_dict['last_pulled'] = time.time() packaged_dict['result'] = cli.format_results(primary, secondary, True) d['full_listing'] = packaged_dict finally: result = d['full_listing']['result'] d.close() return """Content-Type: text/html\n <link href="pagerduty.css" media="all" rel="stylesheet" type="text/css" /> <body class='full_schedule'>\n%s </body> """ % result
def generate_page(): try: d = shelve.open('pagerduty.db') if ('full_listing' not in d or (time.time() - d['full_listing']['last_pulled']) > cache_timeout): # Pull full_schedule global secondary primary = pagerduty.get_user_schedule() if secondary: secondary = pagerduty.get_user_schedule(secondary) # Save pulled information packaged_dict = {} packaged_dict['last_pulled'] = time.time() packaged_dict['result'] = cli.format_results( primary, secondary, True) d['full_listing'] = packaged_dict finally: result = d['full_listing']['result'] d.close() return """Content-Type: text/html\n <link href="pagerduty.css" media="all" rel="stylesheet" type="text/css" /> <body class='full_schedule'>\n%s </body> """ % result
def list_90_days(): global secondary primary = pagerduty.get_user_schedule() if secondary: secondary = pagerduty.get_user_schedule(secondary) print format_results(primary, secondary)
def list_user_90_days(user): global secondary primary = pagerduty.get_user_schedule(needle_name=user) if secondary: secondary = pagerduty.get_user_schedule(secondary, needle_name=user) print format_results(primary, secondary)