urls.py
author Tero Marttila <terom@fixme.fi>
Mon, 16 Feb 2009 01:03:23 +0200
changeset 133 088aa2da1340
parent 118 f530c158aa07
permissions -rw-r--r--
our own CGI error handler

"""
    URL mapping for the irclogs.qmsk.net site
"""

# urltree stuff
from qmsk.web import urltree

# our own handlers
import handlers

# for types
import utils

# for configuration
import config

# our URLTypes
types   = dict(
    # LogChannel
    cid     = utils.URLChannelName(config.LOG_CHANNELS.dict()),

    # datetime
    date    = utils.URLDateType(config.URL_DATE_FMT),

    # UTC timestamp
    ts      = utils.URLTimestampType(),
)

# our URLConfig
urls = url = urltree.URLConfig(type_dict=types)

# urls
index               = url('/',                                                              handlers.index                              )
preferences         = url('/preferences',                                                   handlers.preferences_                       )
channel_select      = url('/channel_select/?channel:cid',                                   handlers.channel_select                     )
channel             = url('/channels/{channel:cid}',                                        handlers.channel_last,      count=20        )
channel_last        = url('/channels/{channel:cid}/last/{count:int=100}/{type=}',           handlers.channel_last                       )
channel_link        = url('/channels/{channel:cid}/link/{timestamp:ts}/?type=',             handlers.channel_link                       )
channel_calendar    = url('/channels/{channel:cid}/calendar/{year:int=0}/{month:int=0}',    handlers.channel_calendar                   )
channel_date        = url('/channels/{channel:cid}/date/{date:date}/?page:int=1&type=',     handlers.channel_date                       )
channel_search      = url('/channels/{channel:cid}/search/?q=&page:int=1&max:int=1&type=&t:list=',  handlers.channel_search                     )

# mapper
mapper = urltree.URLTree(urls)