
"""Main HTTP routes request handlers."""

import tornado.web
import tornado.escape
from os import getcwd


class MainHandler(tornado.web.RequestHandler):
    """Handles creation of new terminals."""

    @tornado.gen.coroutine
    def post(self):
        """POST verb: Create a new terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        cwd = self.get_cookie('cwd', default=getcwd())
        self.application.logger.info('CWD: {0}'.format(cwd))
        self.application.logger.info('Size: ({0}, {1})'.format(cols, rows))
        pid = yield self.application.term_manager.create_term(rows, cols, cwd)
        self.write(pid)


class ResizeHandler(tornado.web.RequestHandler):
    """Handles resizing of terminals."""

    @tornado.gen.coroutine
    def post(self, pid):
        """POST verb: Resize a terminal."""
        rows = int(self.get_argument('rows', None, 23))
        cols = int(self.get_argument('cols', None, 73))
        self.application.term_manager.resize_term(pid, rows, cols)


"""Main HTTP routes request handlers."""

import tornado.web
import tornado.escape
from os import getcwd


class MainHandler(tornado.web.RequestHandler):
    """Handles creation of new terminals."""

    @tornado.gen.coroutine
    def post(self):
        """POST verb: Create a new terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        cwd = self.get_cookie('cwd', default=getcwd())
        self.application.logger.info('CWD: {0}'.format(cwd))
        self.application.logger.info('Size: ({0}, {1})'.format(cols, rows))
        pid = yield self.application.term_manager.create_term(rows, cols, cwd)
        self.write(pid)


class ResizeHandler(tornado.web.RequestHandler):
    """Handles resizing of terminals."""

    @tornado.gen.coroutine
    def post(self, pid):
        """POST verb: Resize a terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        self.application.term_manager.resize_term(pid, rows, cols)

Change default terminal resize arguments
Change default terminal resize arguments

  
  """Main HTTP routes request handlers."""
  
  import tornado.web
  import tornado.escape
  from os import getcwd
  
  
  class MainHandler(tornado.web.RequestHandler):
      """Handles creation of new terminals."""
  
      @tornado.gen.coroutine
      def post(self):
          """POST verb: Create a new terminal."""
          rows = int(self.get_argument('rows', default=23))
          cols = int(self.get_argument('cols', default=73))
          cwd = self.get_cookie('cwd', default=getcwd())
          self.application.logger.info('CWD: {0}'.format(cwd))
          self.application.logger.info('Size: ({0}, {1})'.format(cols, rows))
          pid = yield self.application.term_manager.create_term(rows, cols, cwd)
          self.write(pid)
  
  
  class ResizeHandler(tornado.web.RequestHandler):
      """Handles resizing of terminals."""
  
      @tornado.gen.coroutine
      def post(self, pid):
          """POST verb: Resize a terminal."""
-         rows = int(self.get_argument('rows', None, 23))
+         rows = int(self.get_argument('rows', default=23))
-         cols = int(self.get_argument('cols', None, 73))
+         cols = int(self.get_argument('cols', default=73))
          self.application.term_manager.resize_term(pid, rows, cols)
  
Change default terminal resize arguments
## Code Before:

"""Main HTTP routes request handlers."""

import tornado.web
import tornado.escape
from os import getcwd


class MainHandler(tornado.web.RequestHandler):
    """Handles creation of new terminals."""

    @tornado.gen.coroutine
    def post(self):
        """POST verb: Create a new terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        cwd = self.get_cookie('cwd', default=getcwd())
        self.application.logger.info('CWD: {0}'.format(cwd))
        self.application.logger.info('Size: ({0}, {1})'.format(cols, rows))
        pid = yield self.application.term_manager.create_term(rows, cols, cwd)
        self.write(pid)


class ResizeHandler(tornado.web.RequestHandler):
    """Handles resizing of terminals."""

    @tornado.gen.coroutine
    def post(self, pid):
        """POST verb: Resize a terminal."""
        rows = int(self.get_argument('rows', None, 23))
        cols = int(self.get_argument('cols', None, 73))
        self.application.term_manager.resize_term(pid, rows, cols)

## Instruction:
Change default terminal resize arguments
## Code After:

"""Main HTTP routes request handlers."""

import tornado.web
import tornado.escape
from os import getcwd


class MainHandler(tornado.web.RequestHandler):
    """Handles creation of new terminals."""

    @tornado.gen.coroutine
    def post(self):
        """POST verb: Create a new terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        cwd = self.get_cookie('cwd', default=getcwd())
        self.application.logger.info('CWD: {0}'.format(cwd))
        self.application.logger.info('Size: ({0}, {1})'.format(cols, rows))
        pid = yield self.application.term_manager.create_term(rows, cols, cwd)
        self.write(pid)


class ResizeHandler(tornado.web.RequestHandler):
    """Handles resizing of terminals."""

    @tornado.gen.coroutine
    def post(self, pid):
        """POST verb: Resize a terminal."""
        rows = int(self.get_argument('rows', default=23))
        cols = int(self.get_argument('cols', default=73))
        self.application.term_manager.resize_term(pid, rows, cols)
