--- a/sites/irclogs.qmsk.net/urls.py Sat Feb 07 21:21:10 2009 +0200
+++ b/sites/irclogs.qmsk.net/urls.py Sun Feb 08 00:29:36 2009 +0200
@@ -4,17 +4,34 @@
"""
# urltree stuff
-from urltree import URL, URLTree
+from 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_view = URL( '/channel/{channel}', handlers.channel_view )
-channel_last = URL( '/channel/{channel}/last/{count:int=100}/{format=html}', handlers.channel_last )
-channel_search = URL( '/channel/{channel}/search', handlers.channel_search )
+index = url('/', handlers.index )
+channel_view = url('/channels/{channel:cid}', 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_view, channel_last, channel_search])
+mapper = URLTree(
+ [index, channel_view, channel_last, channel_search]
+)