lib/handler.py
branchsites
changeset 30 a86a25a9f75b
parent 10 d83b10c210e3
child 31 107062ebb6f9
equal deleted inserted replaced
29:b06ff4c05d42 30:a86a25a9f75b
     1 """
     1 """
     2     The actual application behaviour, i.e. generating a Response from a Request :)
     2     The actual application behaviour, i.e. generating a Response from a Request :)
     3 """
     3 """
     4 
     4 
       
     5 class Handler (object) :
       
     6     """
       
     7         A handler handles a Request, returning a Response
       
     8     """
       
     9 
       
    10     def __init__ (self, func, *args, **kwargs) :
       
    11         self.func = func
       
    12         self.args = args
       
    13         self.kwargs = kwargs
       
    14     
       
    15     def handle_request (self, request) :
       
    16         """
       
    17             Handle the request, returning a Response object
       
    18         """
       
    19 
       
    20         return self.func(request, *self.args, **self.kwargs)
       
    21 
       
    22 # fs handler
     5 import http, page, menu, template
    23 import http, page, menu, template
     6 
    24 
     7 def handle_request (request) :
    25 def handle_request (request) :
     8     """
    26     """
     9         Take the Request, and return a Response
    27         Take the Request, and return a Response