urls.py
changeset 140 6db2527b67cf
parent 139 9c7769850195
child 141 65c98c9e1716
equal deleted inserted replaced
139:9c7769850195 140:6db2527b67cf
     1 
       
     2 """
       
     3     URL mapping for the irclogs.qmsk.net site
       
     4 """
       
     5 
       
     6 # urltree stuff
       
     7 from qmsk.web import urltree
       
     8 
       
     9 # our own handlers
       
    10 import handlers
       
    11 
       
    12 # for types
       
    13 import utils
       
    14 
       
    15 # for configuration
       
    16 import config
       
    17 
       
    18 # our URLTypes
       
    19 types   = dict(
       
    20     # LogChannel
       
    21     cid     = utils.URLChannelName(config.LOG_CHANNELS.dict()),
       
    22 
       
    23     # datetime
       
    24     date    = utils.URLDateType(config.URL_DATE_FMT),
       
    25 
       
    26     # UTC timestamp
       
    27     ts      = utils.URLTimestampType(),
       
    28 )
       
    29 
       
    30 # our URLConfig
       
    31 urls = url = urltree.URLConfig(type_dict=types)
       
    32 
       
    33 # urls
       
    34 index               = url('/',                                                              handlers.index                              )
       
    35 preferences         = url('/preferences',                                                   handlers.preferences_                       )
       
    36 channel_select      = url('/channel_select/?channel:cid',                                   handlers.channel_select                     )
       
    37 channel             = url('/channels/{channel:cid}',                                        handlers.channel_last,      count=20        )
       
    38 channel_last        = url('/channels/{channel:cid}/last/{count:int=100}/{type=}',           handlers.channel_last                       )
       
    39 channel_link        = url('/channels/{channel:cid}/link/{timestamp:ts}/?type=',             handlers.channel_link                       )
       
    40 channel_calendar    = url('/channels/{channel:cid}/calendar/{year:int=0}/{month:int=0}',    handlers.channel_calendar                   )
       
    41 channel_date        = url('/channels/{channel:cid}/date/{date:date}/?page:int=1&type=',     handlers.channel_date                       )
       
    42 channel_search      = url('/channels/{channel:cid}/search/?q=&page:int=1&max:int=1&type=&t:list=',  handlers.channel_search                     )
       
    43 
       
    44 # mapper
       
    45 mapper = urltree.URLTree(urls)
       
    46