def grid_new(): """ Creates a new grid and redirects to grid screen """ # Get the grid size from the form n = int(request.args.get('n')) # Remove any leftover grid name in the session session.pop('gridname', None) # Create the grid grid = Grid(n) jsonstr = grid.to_json() session['grid'] = jsonstr session['grid.initial.sha'] = sha256(jsonstr) return redirect(url_for('uigrid.grid_screen'))
def test_to_json(self): grid = Grid(9) grid.add_black_cell(1, 5) grid.add_black_cell(4, 9) jsonstr = grid.to_json() self.assertIsNotNone(jsonstr)