terom@29: """ terom@29: Our URL action handlers terom@29: """ terom@29: terom@46: from qmsk.web import http, template terom@40: terom@42: import urls, channels terom@42: terom@41: # load templates from here terom@42: templates = template.TemplateLoader("sites/irclogs.qmsk.net/templates", terom@42: urls = urls, terom@42: channel_list = channels.channel_list, terom@42: ) terom@40: terom@29: def index (request) : terom@29: """ terom@29: The topmost index page, display a list of available channels, perhaps some general stats terom@29: """ terom@40: terom@42: return templates.render_to_response("index", terom@42: req = request, terom@42: ) terom@42: terom@42: def channel_select (request, channel) : terom@42: """ terom@42: Redirect to the appropriate channel_view terom@42: """ terom@42: terom@42: return http.Redirect(urls.channel_view.build(request, channel=channel.id)) terom@29: terom@43: def channel_view (request, channel, count) : terom@29: """ terom@29: The main channel view page, display the most important info, and all requisite links terom@29: """ terom@29: terom@43: if count == 'all' : terom@43: xxx terom@43: terom@43: else : terom@43: count = int(count) terom@43: terom@40: return templates.render_to_response("channel", terom@42: req = request, terom@41: channel = channel, terom@43: count = count, terom@43: lines = channel.source.get_latest(count), terom@40: ) terom@40: terom@29: pass terom@29: terom@41: def channel_last (request, channel, count, format) : terom@29: """ terom@29: Display the last x lines of channel messages in various formats terom@29: """ terom@29: terom@41: if format == 'txt' : terom@41: return http.Response('\n'.join(channel.source.get_latest(count)), 'text/plain') terom@41: terom@41: else : terom@41: raise http.ResponseError("Unknown filetype %r" % format) terom@29: terom@36: def channel_search (request, channel) : terom@36: """ terom@36: Display the search form for the channel for GET, or do the search for POST terom@36: """ terom@36: terom@36: pass terom@36: