Get the debug flag working correctly
This commit is contained in:
parent
f74433c7c7
commit
a6f90703fb
1 changed files with 7 additions and 1 deletions
|
@ -170,7 +170,12 @@ def hello():
|
||||||
return ("It isn't O's turn.\n\n{}".format(board), 400, {'Content-type': 'text/plain'})
|
return ("It isn't O's turn.\n\n{}".format(board), 400, {'Content-type': 'text/plain'})
|
||||||
|
|
||||||
next_board = board.move()
|
next_board = board.move()
|
||||||
if bool(os.environ.get('TTT_DEBUG', False)):
|
|
||||||
|
try:
|
||||||
|
debug = bool(int(os.environ.get('TTT_DEBUG', 0)))
|
||||||
|
except ValueError:
|
||||||
|
debug = False
|
||||||
|
if debug:
|
||||||
import pprint
|
import pprint
|
||||||
out = str(next_board)
|
out = str(next_board)
|
||||||
out += '\n\n---------- DEBUG ----------'
|
out += '\n\n---------- DEBUG ----------'
|
||||||
|
@ -179,4 +184,5 @@ def hello():
|
||||||
out += '\n\nChildren:\n{}'.format(pprint.pformat(board.children))
|
out += '\n\nChildren:\n{}'.format(pprint.pformat(board.children))
|
||||||
else:
|
else:
|
||||||
out = next_board.board
|
out = next_board.board
|
||||||
|
|
||||||
return (out, 200, {'Content-type': 'text/plain'})
|
return (out, 200, {'Content-type': 'text/plain'})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue