handlers.py
changeset 70 72edbbb414a7
parent 66 090ed78ec8fa
child 72 5ade0288f2ec
equal deleted inserted replaced
69:1f182913b1f2 70:72edbbb414a7
    61 def channel_select (request, channel) :
    61 def channel_select (request, channel) :
    62     """
    62     """
    63         Redirect to the appropriate channel_view
    63         Redirect to the appropriate channel_view
    64     """
    64     """
    65    
    65    
    66     return http.Redirect(urls.channel_view.build(request, channel=channel))
    66     return http.Redirect(urls.channel.build(request, channel=channel))
    67 
    67 
    68 @preferences.handler(prefs.formatter)
    68 @preferences.handler(prefs.formatter)
    69 def channel_view (request, channel, count, formatter) :
    69 def channel_last (request, channel, count, formatter) :
    70     """
    70     """
    71         The main channel view page, display the most important info, and all requisite links
    71         The main channel view page, displaying the most recent lines
    72     """
    72     """
    73     
    73     
    74     # get latest events
    74     # get latest events
    75     lines = channel.source.get_latest(count)
    75     lines = channel.source.get_latest(count)
    76 
    76 
    77     # lines
    77     # lines
    78     lines = formatter.format_html(lines)
    78     lines = formatter.format_html(lines)
    79 
    79 
    80     return templates.render_to_response("channel_view",
    80     return templates.render_to_response("channel_last",
    81         req             = request,
    81         req             = request,
    82         prefs           = request.prefs,
    82         prefs           = request.prefs,
    83         channel         = channel,
    83         channel         = channel,
    84         count           = count,
    84         count           = count,
    85         lines           = lines,
    85         lines           = lines,
    86     )
    86     )
    87 
       
    88 def channel_last (request, channel, count, format) :
       
    89     """
       
    90         Display the last x lines of channel messages in various formats
       
    91     """
       
    92 
       
    93     if format == 'txt' :
       
    94         # XXX: formatting
       
    95 #        return http.Response('\n'.join(str(channel.source.get_latest(count))), 'text/plain')
       
    96          pass
       
    97 
       
    98     elif format == 'html' :
       
    99         pass
       
   100 
       
   101     else :
       
   102         raise http.ResponseError("Unknown filetype %r" % format)
       
   103 
    87 
   104 @preferences.handler(prefs.timezone)
    88 @preferences.handler(prefs.timezone)
   105 def channel_calendar (request, channel, year, month, timezone) :
    89 def channel_calendar (request, channel, year, month, timezone) :
   106     """
    90     """
   107         Display a list of avilable logs for some month
    91         Display a list of avilable logs for some month