def template(title="HELLO!", text="", error=""): now = datetime.datetime.now() timeString = now drip_states = list() last_watered = list() for p in state.pumps: drip_states.append(DripState(p, p in state.drip)) last_watered.append(config.get_last_watered(p)) sensor_states = list() for s in state.sensors: sensor_states.append(sensors.get_value(s)) templateDate = { 'title': title, 'time': timeString, 'text': text, 'error': error, 'logdate': state.logdate, 'logs': logger.get_logs(state.logdate).splitlines(), 'drips': drip_states, 'drip_delay': state.drip_delay, 'drip_duration': state.drip_duration, 'sensors': sensor_states, 'timed': state.timed, 'timed_edit': state.timed_edit, 'drip_edit': state.drip_edit, 'last_watered': last_watered, 'water_now_pump': state.water_now_pump, 'water_now_duration': state.water_now_duration } return templateDate
def show_log(owner, project, pr_number, pr_id, pr_sha1): pr_full_name = "{}/{}".format(owner, project) logs = ibl.get_logs(pr_full_name, pr_number, pr_id, pr_sha1) sql_data = db.get_job_info(pr_id, pr_sha1) payload = db.get_payload_from_pr_id(pr_id, pr_sha1) if payload is not None: commiter_branch = github.pr_branch(payload) commiter_full_name = github.pr_full_name_committer(payload) else: commiter_branch = "n/a" commiter_full_name = commiter_branch return render_template('job.html', sd=sql_data, logs=logs, commiter_branch=commiter_branch, commiter_full_name=commiter_full_name)
if folder != '': os.chdir(folder) parsed = input_parser.parse_markdown(filename) #pprint.pprint(parsed) settings = { 'headingsArePadded': True, 'blockEquationsArePadded': False, 'tocTitle': 'Содержание', 'sectionPageBreak': True, 'headingsAutonumber': True, 'tablesArePadded': False, 'tableName': 'Таблица', 'picturesArePadded': False, 'pictureName': 'Рисунок', 'structNames': ['РЕФЕРАТ', 'ВВЕДЕНИЕ', 'ЗАКЛЮЧЕНИЕ'], 'listStyle': 'word' } generator.set_settings(settings) generator.generate_ast(parsed) filename = re.sub(r'^(.*)\.[^.]+$', r'\1.docx', filename) generator.save(filename) if logger.have_logs(): print(logger.get_logs()) print('Press Enter to close this window') input() else: print('Succesfully generated ' + filename + '!') except: print(traceback.format_exc()) input()
def logs(self): print(logger.get_logs())