sites/irclogs.qmsk.net/urls.py
changeset 46 185504387370
parent 45 e94ab812c0c8
child 47 3d59c9eeffaa
equal deleted inserted replaced
45:e94ab812c0c8 46:185504387370
     1 
       
     2 """
       
     3     URL mapping for the irclogs.qmsk.net site
       
     4 """
       
     5 
       
     6 # urltree stuff
       
     7 from lib.urltree import URLConfig, URL, URLTree
       
     8 
       
     9 # our own handlers
       
    10 import handlers
       
    11 
       
    12 # for types
       
    13 import channels 
       
    14 
       
    15 # our URLConfig
       
    16 url_config = URLConfig(
       
    17     type_dict   = { 
       
    18         # lookup LogChannel
       
    19         'cid': channels.channel_list.lookup 
       
    20     }
       
    21 )
       
    22 
       
    23 # shortcut for building an URL with our url_config
       
    24 def url (*args, **kwargs) :
       
    25     return URL(url_config, *args, **kwargs)
       
    26 
       
    27 # urls
       
    28 index           = url('/',                                                              handlers.index                  )
       
    29 channel_select  = url('/channel_select/?channel:cid',                                   handlers.channel_select         )
       
    30 channel_view    = url('/channels/{channel:cid}/?count:str=10',                          handlers.channel_view           )
       
    31 channel_last    = url('/channels/{channel:cid}/last/{count:int=100}/{format=html}',     handlers.channel_last           )
       
    32 channel_search  = url('/channels/{channel:cid}/search',                                 handlers.channel_search         )
       
    33 
       
    34 # mapper
       
    35 mapper = URLTree(
       
    36     [index, channel_select, channel_view, channel_last, channel_search]
       
    37 )
       
    38