Exemplo n.º 1
0
 def serve_request(self, path):
     """Given an URL path, return response.
     """
     request = Request(uri=path)
     request.website = self
     response = self.handle_safely(request)
     return response
Exemplo n.º 2
0
 def serve_request(self, path):
     """Given an URL path, return response.
     """
     request = Request(uri=path)
     request.website = self
     response = self.handle_safely(request)
     return response
Exemplo n.º 3
0
 def load_simplate(self, path, request=None, return_request_too=False):
     """Given an URL path, return a simplate (Resource) object.
     """
     if request is None:
         request = Request(uri=path)
     if not hasattr(request, 'website'):
         request.website = self
     self.do_inbound(request)
     resource = resources.get(request)
     if return_request_too:
         return resource, request
     else:
         return resource
Exemplo n.º 4
0
 def load_simplate(self, path, request=None, return_request_too=False):
     """Given an URL path, return a simplate (Resource) object.
     """
     if request is None:
         request = Request(uri=path)
     if not hasattr(request, 'website'):
         request.website = self
     self.do_inbound(request)
     resource = resources.get(request)
     if return_request_too:
         return resource, request
     else:
         return resource
Exemplo n.º 5
0
def make_request(filename='echo.sock'):
    request = Request(uri='/echo.sock')
    request.website = Website([])
    request.fs = fix(filename)
    return request
Exemplo n.º 6
0
def make_request(filename='echo.sock'):
    request = Request(url='/echo.sock')
    request.website = Website([])
    request.website.copy_configuration_to(request)
    request.fs = fix(filename)
    return request
Exemplo n.º 7
0
def make_request(filename="echo.sock.spt"):
    request = Request(uri="/echo.sock")
    request.website = Website([])
    request.fs = fix(filename)
    return request
Exemplo n.º 8
0
def get_simplate_context(website, fs):
    request = Request()
    request.fs = fs
    request.website = website
    resource = resources.get(request)
    return {} if isinstance(resource, StaticResource) else resource.pages[0]
Exemplo n.º 9
0
 def make_socket_request(self, filename="echo.sock.spt"):
     request = Request(uri="/echo.sock")
     request.website = self.client.website
     request.fs = self.fs.www.resolve(filename)
     return request
Exemplo n.º 10
0
def make_request(filename='echo.sock'):
    request = Request(url='/echo.sock')
    request.website = Website([])
    request.website.copy_configuration_to(request)
    request.fs = os.sep.join([os.path.dirname(__file__), 'fsfix', filename])
    return request
Exemplo n.º 11
0
def get_simplate_context(website, fs):
    request = Request()
    request.fs = fs
    request.website = website
    resource = resources.get(request)
    return {} if isinstance(resource, StaticResource) else resource.pages[0]
Exemplo n.º 12
0
def make_request(filename='echo.sock'):
    request = Request(uri='/echo.sock')
    request.website = Website([])
    request.fs = fix(filename)
    return request