Blob Blame Raw


import answer

class Request:
  def __init__(self, server, env, start_response):
    self.server = server
    self.env = env
    self.method = str(self.env["REQUEST_METHOD"])
    assert self.method == 'GET' or self.method == 'POST'
    self.readonly = self.method == 'GET'
    
    self.path = None
    prefix = self.server.config['urlprefix']
    path = self.env["REQUEST_URI"]
    if path.startswith(prefix):
      path = path[len(prefix):]
      self.path = [x for x in path.split('/') if x]

    self.connection = None
    self.session = None
    
    self.answer = answer.Answer(self, start_response)