# HG changeset patch # User Tero Marttila # Date 1233979510 -7200 # Node ID b06ff4c05d4285800671b6e799aecb9bd99a9de0 # Parent b68145b5ce24d097d2deecebeebb65f6a2cc4624 start prototyping some site-based code diff -r b68145b5ce24 -r b06ff4c05d42 lib/helpers.py --- a/lib/helpers.py Sat Feb 07 05:12:57 2009 +0200 +++ b/lib/helpers.py Sat Feb 07 06:05:10 2009 +0200 @@ -13,6 +13,13 @@ return time.strftime(config.DATETIME_FMT) +def copyright_year () : + """ + Returns the current year + """ + + return time.strftime("%Y") + def breadcrumb (trail, links=True) : """ Returns a nicely formatted breadcrumb tail, optinally with links diff -r b68145b5ce24 -r b06ff4c05d42 lib/site.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/site.py Sat Feb 07 06:05:10 2009 +0200 @@ -0,0 +1,14 @@ +""" + Per-site stuff +""" + +SITE_DIR = "sites" + +class Site (object) : + """ + A site is a website and its configuration + """ + + pass + + diff -r b68145b5ce24 -r b06ff4c05d42 sites/irclogs.qmsk.net/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sites/irclogs.qmsk.net/__init__.py Sat Feb 07 06:05:10 2009 +0200 @@ -0,0 +1,7 @@ +""" + The irclogs.qmsk.net site is an IRC log browser +""" + +# the URL mapper +from urls import url_mapper + diff -r b68145b5ce24 -r b06ff4c05d42 sites/irclogs.qmsk.net/handlers.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sites/irclogs.qmsk.net/handlers.py Sat Feb 07 06:05:10 2009 +0200 @@ -0,0 +1,25 @@ +""" + Our URL action handlers +""" + +def index (request) : + """ + The topmost index page, display a list of available channels, perhaps some general stats + """ + + pass + +def channel_view (request, channel) : + """ + The main channel view page, display the most important info, and all requisite links + """ + + pass + +def channel_last (request, channel, lines, type='html') : + """ + Display the last x lines of channel messages in various formats + """ + + pass + diff -r b68145b5ce24 -r b06ff4c05d42 sites/irclogs.qmsk.net/templates/index.tmpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sites/irclogs.qmsk.net/templates/index.tmpl Sat Feb 07 06:05:10 2009 +0200 @@ -0,0 +1,2 @@ +Index page template + diff -r b68145b5ce24 -r b06ff4c05d42 sites/irclogs.qmsk.net/urls.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sites/irclogs.qmsk.net/urls.py Sat Feb 07 06:05:10 2009 +0200 @@ -0,0 +1,22 @@ + +""" + URL mapping for the irclogs.qmsk.net site +""" + +# our own handlers +import handlers + +# library stuff +from lib.map import Mapping, map, mapre + +def url_mapper () : + """ + Construct and return the Mapping object + """ + + return Mapping( + map( '/', handlers.index ), + map( '/channel/%s', handlers.channel_view ), + mapre( r'^/channel/(\w+)/last/(\d+)(\.\w+)?', handlers.channel_last ), + ) + diff -r b68145b5ce24 -r b06ff4c05d42 templates/layout.tmpl --- a/templates/layout.tmpl Sat Feb 07 05:12:57 2009 +0200 +++ b/templates/layout.tmpl Sat Feb 07 06:05:10 2009 +0200 @@ -44,7 +44,7 @@