urls.py
author Tero Marttila <terom@fixme.fi>
Sun, 08 Feb 2009 03:23:25 +0200
changeset 46 185504387370
parent 45 sites/irclogs.qmsk.net/urls.py@e94ab812c0c8
child 49 aaa62c8e5bd5
permissions -rw-r--r--
reduce to irclogs.qmsk.net site

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

# urltree stuff
from qmsk.web.urltree import URLConfig, URL, URLTree

# our own handlers
import handlers

# for types
import channels 

# our URLConfig
url_config = URLConfig(
    type_dict   = { 
        # lookup LogChannel
        'cid': channels.channel_list.lookup 
    }
)

# shortcut for building an URL with our url_config
def url (*args, **kwargs) :
    return URL(url_config, *args, **kwargs)

# urls
index           = url('/',                                                              handlers.index                  )
channel_select  = url('/channel_select/?channel:cid',                                   handlers.channel_select         )
channel_view    = url('/channels/{channel:cid}/?count:str=10',                          handlers.channel_view           )
channel_last    = url('/channels/{channel:cid}/last/{count:int=100}/{format=html}',     handlers.channel_last           )
channel_search  = url('/channels/{channel:cid}/search',                                 handlers.channel_search         )

# mapper
mapper = URLTree(
    [index, channel_select, channel_view, channel_last, channel_search]
)