urls.py
author Tero Marttila <terom@fixme.fi>
Fri, 13 Feb 2009 00:29:47 +0200
changeset 121 86aebc9cb60b
parent 118 f530c158aa07
permissions -rw-r--r--
some quickfixes to fix deployment errors
29
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
"""
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
    URL mapping for the irclogs.qmsk.net site
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
"""
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
39
82df0bb66ca7 split off to urltree.py, and add support for types
Tero Marttila <terom@fixme.fi>
parents: 38
diff changeset
     6
# urltree stuff
50
f13cf27a360b implement more LogSource features (logs for date, cleanup last_logs), implement irssi parser, formatter, other misc. stuff
Tero Marttila <terom@fixme.fi>
parents: 49
diff changeset
     7
from qmsk.web import urltree
36
02d4040d5946 start working on some nify URL parsing
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
     8
29
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
# our own handlers
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
import handlers
b06ff4c05d42 start prototyping some site-based code
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
41
9585441a4bfb working basic logs stuff
Tero Marttila <terom@fixme.fi>
parents: 39
diff changeset
    12
# for types
51
07ca28f3a9f2 use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents: 50
diff changeset
    13
import utils
07ca28f3a9f2 use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents: 50
diff changeset
    14
07ca28f3a9f2 use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents: 50
diff changeset
    15
# for configuration
73
5a7188bf2894 split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents: 72
diff changeset
    16
import config
41
9585441a4bfb working basic logs stuff
Tero Marttila <terom@fixme.fi>
parents: 39
diff changeset
    17
72
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    18
# our URLTypes
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    19
types   = dict(
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    20
    # LogChannel
73
5a7188bf2894 split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents: 72
diff changeset
    21
    cid     = utils.URLChannelName(config.LOG_CHANNELS.dict()),
72
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    22
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    23
    # datetime
73
5a7188bf2894 split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents: 72
diff changeset
    24
    date    = utils.URLDateType(config.URL_DATE_FMT),
72
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    25
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    26
    # UTC timestamp
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    27
    ts      = utils.URLTimestampType(),
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    28
)
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    29
41
9585441a4bfb working basic logs stuff
Tero Marttila <terom@fixme.fi>
parents: 39
diff changeset
    30
# our URLConfig
72
5ade0288f2ec implement line-links as UTC timestamps
Tero Marttila <terom@fixme.fi>
parents: 70
diff changeset
    31
urls = url = urltree.URLConfig(type_dict=types)
41
9585441a4bfb working basic logs stuff
Tero Marttila <terom@fixme.fi>
parents: 39
diff changeset
    32
36
02d4040d5946 start working on some nify URL parsing
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    33
# urls
70
72edbbb414a7 merge channel_view and channel_last, adding a More link to channel_last.tmpl
Tero Marttila <terom@fixme.fi>
parents: 66
diff changeset
    34
index               = url('/',                                                              handlers.index                              )
72edbbb414a7 merge channel_view and channel_last, adding a More link to channel_last.tmpl
Tero Marttila <terom@fixme.fi>
parents: 66
diff changeset
    35
preferences         = url('/preferences',                                                   handlers.preferences_                       )
72edbbb414a7 merge channel_view and channel_last, adding a More link to channel_last.tmpl
Tero Marttila <terom@fixme.fi>
parents: 66
diff changeset
    36
channel_select      = url('/channel_select/?channel:cid',                                   handlers.channel_select                     )
72edbbb414a7 merge channel_view and channel_last, adding a More link to channel_last.tmpl
Tero Marttila <terom@fixme.fi>
parents: 66
diff changeset
    37
channel             = url('/channels/{channel:cid}',                                        handlers.channel_last,      count=20        )
79
43ac75054d5c image formatting \o/
Tero Marttila <terom@fixme.fi>
parents: 77
diff changeset
    38
channel_last        = url('/channels/{channel:cid}/last/{count:int=100}/{type=}',           handlers.channel_last                       )
108
d0aca7894fc5 split out helpers._render_type, and add support for ?type= to various other handlers... still needs more work, though
Tero Marttila <terom@fixme.fi>
parents: 79
diff changeset
    39
channel_link        = url('/channels/{channel:cid}/link/{timestamp:ts}/?type=',             handlers.channel_link                       )
70
72edbbb414a7 merge channel_view and channel_last, adding a More link to channel_last.tmpl
Tero Marttila <terom@fixme.fi>
parents: 66
diff changeset
    40
channel_calendar    = url('/channels/{channel:cid}/calendar/{year:int=0}/{month:int=0}',    handlers.channel_calendar                   )
108
d0aca7894fc5 split out helpers._render_type, and add support for ?type= to various other handlers... still needs more work, though
Tero Marttila <terom@fixme.fi>
parents: 79
diff changeset
    41
channel_date        = url('/channels/{channel:cid}/date/{date:date}/?page:int=1&type=',     handlers.channel_date                       )
118
f530c158aa07 implement some basic search-targets for message and nickname
Tero Marttila <terom@fixme.fi>
parents: 108
diff changeset
    42
channel_search      = url('/channels/{channel:cid}/search/?q=&page:int=1&max:int=1&type=&t:list=',  handlers.channel_search                     )
36
02d4040d5946 start working on some nify URL parsing
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    43
02d4040d5946 start working on some nify URL parsing
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    44
# mapper
50
f13cf27a360b implement more LogSource features (logs for date, cleanup last_logs), implement irssi parser, formatter, other misc. stuff
Tero Marttila <terom@fixme.fi>
parents: 49
diff changeset
    45
mapper = urltree.URLTree(urls)
36
02d4040d5946 start working on some nify URL parsing
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    46