sites/irclogs.qmsk.net/handlers.py
branchsites
changeset 42 5a72c00c4ae4
parent 41 9585441a4bfb
child 43 fc11c4e86a82
equal deleted inserted replaced
41:9585441a4bfb 42:5a72c00c4ae4
     2     Our URL action handlers
     2     Our URL action handlers
     3 """
     3 """
     4 
     4 
     5 from lib import http, template
     5 from lib import http, template
     6 
     6 
       
     7 import urls, channels
       
     8 
     7 # load templates from here
     9 # load templates from here
     8 templates = template.TemplateLoader("sites/irclogs.qmsk.net/templates")
    10 templates = template.TemplateLoader("sites/irclogs.qmsk.net/templates",
       
    11     urls            = urls,
       
    12     channel_list    = channels.channel_list,
       
    13 )
     9 
    14 
    10 def index (request) :
    15 def index (request) :
    11     """
    16     """
    12         The topmost index page, display a list of available channels, perhaps some general stats
    17         The topmost index page, display a list of available channels, perhaps some general stats
    13     """
    18     """
    14     
    19     
    15     return templates.render_to_response("index")
    20     return templates.render_to_response("index",
       
    21         req             = request,
       
    22     )
       
    23 
       
    24 def channel_select (request, channel) :
       
    25     """
       
    26         Redirect to the appropriate channel_view
       
    27     """
       
    28    
       
    29     return http.Redirect(urls.channel_view.build(request, channel=channel.id))
    16 
    30 
    17 def channel_view (request, channel) :
    31 def channel_view (request, channel) :
    18     """
    32     """
    19         The main channel view page, display the most important info, and all requisite links
    33         The main channel view page, display the most important info, and all requisite links
    20     """
    34     """
    21 
    35 
    22     return templates.render_to_response("channel",
    36     return templates.render_to_response("channel",
       
    37         req             = request,
    23         channel         = channel,
    38         channel         = channel,
    24     )
    39     )
    25 
    40 
    26     pass
    41     pass
    27 
    42