comparison piecrust/admin/pubutil.py @ 812:82509bce94ca

internal: PEP8 fixup for admin panel code.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 20 Dec 2016 22:20:18 -0800
parents 5e91bc0e3b4d
children
comparison
equal deleted inserted replaced
811:c7393ce2dde7 812:82509bce94ca
28 def record_pipeline(state): 28 def record_pipeline(state):
29 if state.app.config.get('FOODTRUCK_CMDLINE_MODE', False): 29 if state.app.config.get('FOODTRUCK_CMDLINE_MODE', False):
30 # Make sure CTRL+C works correctly. 30 # Make sure CTRL+C works correctly.
31 logger.debug("Adding SIGINT callback for pipeline thread.") 31 logger.debug("Adding SIGINT callback for pipeline thread.")
32 signal.signal( 32 signal.signal(
33 signal.SIGINT, 33 signal.SIGINT,
34 lambda *args: _shutdown_server_and_raise_sigint( 34 lambda *args: _shutdown_server_and_raise_sigint(
35 state.app.debug)) 35 state.app.debug))
36 36
37 37
38 foodtruck_bp.record(record_pipeline) 38 foodtruck_bp.record(record_pipeline)
39 39
40 40
115 # currently running. 115 # currently running.
116 was_running = is_running 116 was_running = is_running
117 if pid: 117 if pid:
118 is_running = _pid_exists(pid) 118 is_running = _pid_exists(pid)
119 logger.debug( 119 logger.debug(
120 "Process %d is %s" % 120 "Process %d is %s" %
121 (pid, 'running' if is_running else 'not running')) 121 (pid, 'running' if is_running else 'not running'))
122 if not is_running: 122 if not is_running:
123 # Let's forget this PID file until it changes. 123 # Let's forget this PID file until it changes.
124 pid = None 124 pid = None
125 else: 125 else:
126 is_running = False 126 is_running = False
133 # actually caught the process as it was starting, not 133 # actually caught the process as it was starting, not
134 # if we started streaming after it started. 134 # if we started streaming after it started.
135 # This means we saw the PID file get changed. 135 # This means we saw the PID file get changed.
136 if not is_pid_file_prehistoric: 136 if not is_pid_file_prehistoric:
137 outstr = ( 137 outstr = (
138 'event: message\n' 138 'event: message\n'
139 'data: Publish started.\n\n') 139 'data: Publish started.\n\n')
140 yield bytes(outstr, 'utf8') 140 yield bytes(outstr, 'utf8')
141 last_seek = 0 141 last_seek = 0
142 142
143 try: 143 try:
144 with open(self.log_path, 'r', encoding='utf8') as fp: 144 with open(self.log_path, 'r', encoding='utf8') as fp: