sites/irclogs.qmsk.net/handlers.py
branchsites
changeset 41 9585441a4bfb
parent 40 71ab68f31a1c
child 42 5a72c00c4ae4
--- a/sites/irclogs.qmsk.net/handlers.py	Sat Feb 07 21:21:10 2009 +0200
+++ b/sites/irclogs.qmsk.net/handlers.py	Sun Feb 08 00:29:36 2009 +0200
@@ -2,8 +2,9 @@
     Our URL action handlers
 """
 
-from lib import template
+from lib import http, template
 
+# load templates from here
 templates = template.TemplateLoader("sites/irclogs.qmsk.net/templates")
 
 def index (request) :
@@ -19,17 +20,21 @@
     """
 
     return templates.render_to_response("channel",
-        channel_name        = channel,
+        channel         = channel,
     )
 
     pass
 
-def channel_last (request, channel, lines, type) :
+def channel_last (request, channel, count, format) :
     """
         Display the last x lines of channel messages in various formats
     """
 
-    pass
+    if format == 'txt' :
+        return http.Response('\n'.join(channel.source.get_latest(count)), 'text/plain')
+    
+    else :
+        raise http.ResponseError("Unknown filetype %r" % format)
 
 def channel_search (request, channel) :
     """