示例#1
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)

    mc('/login',    controller='forms', action='login')
    mc('/register',    controller='forms', action='register')
    mc('/logout',   controller='forms', action='logout')
    mc('/verify',   controller='forms', action='verify')
    mc('/adminon',  controller='forms', action='adminon')
    mc('/adminoff', controller='forms', action='adminoff')
    mc('/submit',   controller='front', action='submit')
    mc('/validuser',   controller='forms', action='validuser')

    mc('/over18',   controller='post', action='over18')

    mc('/search', controller='front', action='search')

    mc('/sup', controller='front', action='sup')
    mc('/traffic', controller='front', action='site_traffic')
    mc('/account-activity', controller='front', action='account_activity')

    mc('/about/message/:where', controller='message', action='listing')
    mc('/about/log', controller='front', action='moderationlog')
    mc('/about', controller='front', action='about')
    mc('/about/:location', controller='front', 
       action='editreddit', location = 'about')

    mc('/reddits/create', controller='front', action='newreddit')
    mc('/reddits/search', controller='front', action='search_reddits')
    mc('/reddits/login', controller='forms', action='login')
    mc('/reddits/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))

    mc('/reddits/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))

    mc('/buttons', controller='buttons', action='button_demo_page')
    mc('/upgradebuttons', controller='buttons', action='upgrade_buttons')
    #the frame
    mc('/button_content', controller='buttons', action='button_content')
    #/button.js and buttonlite.js - the embeds
    mc('/button', controller='buttonjs', action='button_embed')
    mc('/buttonlite', controller='buttons', action='button_lite')

    mc('/widget', controller='buttons', action='widget_demo_page')
    mc('/bookmarklets', controller='buttons', action='bookmarklets')
    mc('/iphonebookmarklet', controller='buttons', action='iphonebookmarklets')

    mc('/awards', controller='front', action='awards')

    mc('/i18n', controller='redirect', action='redirect',
       dest='http://www.reddit.com/r/i18n')
    mc('/feedback', controller='feedback', action='feedback')
    mc('/ad_inq',   controller='feedback', action='ad_inq')

    mc('/admin/usage', controller='usage')

    # Used for editing ads
    mc('/admin/ads', controller='ads')
    mc('/admin/ads/:adcn/:action', controller='ads',
       requirements=dict(action="assign|srs"))

    mc('/admin/awards', controller='awards')
    mc('/admin/awards/:awardcn/:action', controller='awards',
       requirements=dict(action="give|winners"))

    mc('/admin/errors', controller='errorlog')

    mc('/admin/:action', controller='admin')

    mc('/user/:username/about', controller='user', action='about',
       where='overview')
    mc('/user/:username/:where', controller='user', action='listing',
       where='overview')
    mc('/u/:username', controller='redirect', action='user_redirect')

    # preserve timereddit URLs from 4/1/2012
    mc('/t/:timereddit', controller='redirect', action='timereddit_redirect')
    mc('/t/:timereddit/*rest', controller='redirect',
       action='timereddit_redirect')

    mc('/prefs/:location', controller='forms',
       action='prefs', location='options')

    mc('/depmod', controller='forms', action='depmod')

    mc('/info/0:article/*rest', controller = 'front', 
       action='oldinfo', dest='comments', type='ancient')
    mc('/info/:article/:dest/:comment', controller='front',
       action='oldinfo', type='old', dest='comments', comment=None)

    mc('/related/:article/:title', controller='front',
       action = 'related', title=None)
    mc('/details/:article/:title', controller='front',
       action = 'details', title=None)
    mc('/traffic/:article/:title', controller='front',
       action = 'traffic', title=None)
    mc('/comments/:article/:title/:comment', controller='front', 
       action = 'comments', title=None, comment = None)
    mc('/duplicates/:article/:title', controller = 'front',
       action = 'duplicates', title=None)

    mc('/mail/optout', controller='forms', action = 'optout')
    mc('/mail/optin',  controller='forms', action = 'optin')
    mc('/stylesheet', controller = 'front', action = 'stylesheet')
    mc('/frame', controller='front', action = 'frame')
    mc('/framebuster/:blah', controller='front', action = 'framebuster')
    mc('/framebuster/:what/:blah',
       controller='front', action = 'framebuster')

    mc('/promoted/edit_promo/:link',
       controller='promote', action = 'edit_promo')
    mc('/promoted/pay/:link/:indx',
       controller='promote', action = 'pay')
    mc('/promoted/graph',
       controller='promote', action = 'graph')
    mc('/promoted/:action', controller='promote',
       requirements = dict(action = "edit_promo|new_promo|roadblock"))
    mc('/promoted/:sort', controller='promote', action = "listing")
    mc('/promoted/', controller='promoted', action = "listing",
       sort = "")

    mc('/health', controller='health', action='health')

    mc('/', controller='hot', action='listing')

    listing_controllers = "hot|saved|new|randomrising|comments"

    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))

    mc('/message/compose', controller='message', action='compose')
    mc('/message/messages/:mid', controller='message', action='listing',
       where = "messages")
    mc('/message/:where', controller='message', action='listing')
    mc('/message/moderator/:subwhere', controller='message', action='listing',
       where = 'moderator')

    mc('/thanks', controller='forms', action="thanks", secret = '')
    mc('/thanks/:secret', controller='forms', action="thanks")

    mc('/gold', controller='forms', action="gold")

    mc('/password', controller='forms', action="password")
    mc('/:action', controller='front',
       requirements=dict(action="random|framebuster|selfserviceoatmeal"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog|faq"))
    mc('/help/*anything', controller='embed', action='help')

    mc('/goto', controller='toolbar', action='goto')
    mc('/tb/:id', controller='toolbar', action='tb')
    mc('/toolbar/:action', controller='toolbar',
       requirements=dict(action="toolbar|inner|login"))
    mc('/toolbar/comments/:id', controller='toolbar', action='comments')

    mc('/c/:comment_id', controller='front', action='comment_by_id')

    mc('/s/*rest', controller='toolbar', action='s')
    # additional toolbar-related rules just above the catchall

    mc('/d/:what', controller='api', action='bookmarklet')

    mc('/resetpassword/:key', controller='forms',
       action='resetpassword')
    mc('/verification/:key', controller='forms',
       action='verify_email')
    mc('/resetpassword', controller='forms',
       action='resetpassword')

    mc('/post/:action/:url_user', controller='post',
       requirements=dict(action="login|reg"))
    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18|unlogged_options|optout|optin|login|reg"))

    mc('/api', controller='redirect', action='redirect', dest='/dev/api')
    mc('/api/distinguish/:how', controller='api', action="distinguish")
    # wherever this is, google has to agree.
    mc('/api/gcheckout', controller='ipn', action='gcheckout')
    mc('/api/spendcreddits', controller='ipn', action="spendcreddits")
    mc('/api/ipn/:secret', controller='ipn', action='ipn')
    mc('/ipn/:secret',     controller='ipn', action='ipn')
    mc('/api/:action/:url_user', controller='api',
       requirements=dict(action="login|register"))
    mc('/api/gadget/click/:ids', controller = 'api', action='gadget', type='click')
    mc('/api/gadget/:type', controller = 'api', action='gadget')
    mc('/api/:action', controller='promote',
       requirements=dict(action="promote|unpromote|edit_promo|link_thumb|freebie|promote_note|update_pay|refund|traffic_viewer|rm_traffic_viewer|edit_campaign|delete_campaign|meta_promo|add_roadblock|rm_roadblock"))
    mc('/api/:action', controller='apiminimal',
       requirements=dict(action="new_captcha"))
    mc('/api/:action', controller='api')

    mc("/api/v1/:action", controller="oauth2frontend", requirements=dict(action="authorize"))
    mc("/api/v1/:action", controller="oauth2access", requirements=dict(action="access_token"))
    mc("/api/v1/:action", controller="apiv1")

    mc('/dev', controller='redirect', action='redirect', dest='/dev/api')
    mc('/dev/api', controller='apidocs', action='docs')

    mc("/button_info", controller="api", action="info", limit = 1)

    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/mediaembed/:link', controller="mediaembed", action="mediaembed")

    mc('/doquery', controller='query', action='doquery')

    mc('/store', controller='redirect', action='redirect',
       dest='http://store.reddit.com/index.html')

    mc('/code', controller='redirect', action='redirect',
       dest='http://github.com/reddit/')

    mc('/mobile', controller='redirect', action='redirect',
       dest='http://m.reddit.com/')

    mc('/authorize_embed', controller = 'front', action = 'authorize_embed')

    # Used for showing ads
    mc("/ads/", controller = "ad", action = "ad")
    mc("/ads/r/:reddit_name/:keyword", controller = "ad", action = "ad", keyword=None)
    mc("/ads/:codename", controller = "ad", action = "ad_by_codename")

    mc("/try", controller = "forms", action = "try_compact")
    mc('/comscore-iframe/', controller='mediaembed', action='comscore')
    mc('/comscore-iframe/*url', controller='mediaembed', action='comscore')

    # This route handles displaying the error page and 
    # graphics used in the 404/500
    # error pages. It should likely stay at the top 
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    # these should be near the buttom, because they should only kick
    # in if everything else fails. It's the attempted catch-all
    # reddit.com/http://... and reddit.com/34fr, but these redirect to
    # the less-guessy versions at /s/ and /tb/
    mc('/:linkoid', controller='toolbar', action='linkoid',
       requirements=dict(linkoid='[0-9a-z]{1,6}'))
    mc('/:urloid', controller='toolbar', action='urloid',
       requirements=dict(urloid=r'(\w+\.\w{2,}|https?).*'))

    mc("/*url", controller='front', action='catchall')

    return map
示例#2
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)

    mc('/login',    controller='front', action='login')
    mc('/logout',   controller='front', action='logout')
    mc('/adminon',  controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit',   controller='front', action='submit')

    mc('/imagebrowser', controller='front', action='imagebrowser')
    mc('/imagebrowser/:article', controller='front', action='imagebrowser')

    mc('/validuser',   controller='front', action='validuser')

    mc('/over18',   controller='post', action='over18')

    mc('/search/results', controller='front', action='search_results')

    mc('/about/:location', controller='front',
       action='editreddit', location = 'about')

    mc('/categories/create', controller='front', action='newreddit')
    mc('/categories/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))

    mc('/categories/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))

    #mc('/stats', controller='front', action='stats')

    mc('/user/:username/:where', controller='user', action='listing',
       where='profile')

    mc('/prefs/:location', controller='front',
       action='prefs', location='options')

    mc('/related/:article/:title', controller='front',
       action = 'related', title=None)
    mc('/lw/:article/:title/:comment', controller='front',
       action= 'comments', title=None, comment = None)
    mc('/edit/:article', controller='front', action="editarticle")


    mc('/stylesheet', controller = 'front', action = 'stylesheet')

    mc('/', controller='promoted', action='listing')
    
    for name,page in allWikiPagesCached.items():
        if page.has_key('route'):
            mc("/wiki/"+page['route'], controller='wikipage', action='wikipage', name=name)
        
    mc('/invalidate_cache', controller='wikipage', action='invalidate_cache')

    listing_controllers = "hot|saved|toplinks|topcomments|new|recommended|randomrising|comments|blessed|recentposts|edits|promoted"

    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    # Can't use map.resource because the version of the Routing module we're
    # using doesn't support the controller_action kw arg
    #map.resource('meetup', 'meetups', collection_actions=['create', 'new'])
    mc('/meetups/create', action='create', controller='meetups')
    mc('/meetups', action='listing', controller='meetupslisting')
    mc('/meetups/new', action='new', controller='meetups')
    mc('/meetups/:id/edit', action='edit', controller='meetups')
    mc('/meetups/:id/update', action='update', controller='meetups')
    mc('/meetups/:id', action='show', controller='meetups')

    mc('/tag/:tag', controller='tag', action='listing', where='tag')

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))

    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')

    mc('/:action', controller='front',
       requirements=dict(action="password|random|framebuster"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog"))

    mc('/:action', controller='toolbar',
       requirements=dict(action="goto|toolbar"))

    mc('/resetpassword/:key', controller='front',
       action='resetpassword')
    mc('/resetpassword', controller='front',
       action='resetpassword')

    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18|optout|optin|login|reg"))

    mc('/api/:action', controller='api')

    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/doquery', controller='query', action='doquery')

    mc('/code', controller='redirect', action='redirect',
       dest='http://code.google.com/p/lesswrong/')

    mc('/about-less-wrong', controller='front', action='about')
    mc('/issues', controller='front', action='issues')

    # Google webmaster tools verification page
    mc('/googlea26ba8329f727095.html', controller='front', action='blank')

    # This route handles displaying the error page and
    # graphics used in the 404/500
    # error pages. It should likely stay at the top
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    mc("/*url", controller='front', action='catchall')

    return map
示例#3
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)

    mc('/login', controller='front', action='login')
    mc('/logout', controller='front', action='logout')
    mc('/adminon', controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit', controller='front', action='submit')

    mc('/imagebrowser', controller='front', action='imagebrowser')
    mc('/imagebrowser/:article', controller='front', action='imagebrowser')

    mc('/validuser', controller='front', action='validuser')

    mc('/over18', controller='post', action='over18')

    mc('/search/results', controller='front', action='search_results')

    mc('/about/:location',
       controller='front',
       action='editreddit',
       location='about')

    mc('/categories/create', controller='front', action='newreddit')
    mc('/categories/:where',
       controller='reddits',
       action='listing',
       where='popular',
       requirements=dict(where="popular|new|banned"))

    mc('/categories/mine/:where',
       controller='myreddits',
       action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))

    #mc('/stats', controller='front', action='stats')

    mc('/user/:username/:where',
       controller='user',
       action='listing',
       where='overview')

    mc('/prefs/:location',
       controller='front',
       action='prefs',
       location='options')

    mc('/related/:article/:title',
       controller='front',
       action='related',
       title=None)
    mc('/lw/:article/:title/:comment',
       controller='front',
       action='comments',
       title=None,
       comment=None)
    mc('/edit/:article', controller='front', action="editarticle")

    mc('/stylesheet', controller='front', action='stylesheet')

    mc('/', controller='root', action='listing')

    listing_controllers = "hot|saved|toplinks|topcomments|new|recommended|randomrising|comments|blessed|recentposts"

    mc('/:controller',
       action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/tag/:tag', controller='tag', action='listing', where='tag')

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort',
       controller='browse',
       sort='top',
       action='listing',
       requirements=dict(sort='top|controversial'))

    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')

    mc('/:action',
       controller='front',
       requirements=dict(action="password|random|framebuster"))
    mc('/:action', controller='embed', requirements=dict(action="help|blog"))

    mc('/:action',
       controller='toolbar',
       requirements=dict(action="goto|toolbar"))

    mc('/resetpassword/:key', controller='front', action='resetpassword')
    mc('/resetpassword', controller='front', action='resetpassword')

    mc('/post/:action',
       controller='post',
       requirements=dict(
           action="options|over18|unlogged_options|optout|optin|login|reg"))

    mc('/api/:action', controller='api')

    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/doquery', controller='query', action='doquery')

    mc('/code',
       controller='redirect',
       action='redirect',
       dest='http://code.google.com/p/lesswrong/')

    mc('/about-less-wrong', controller='front', action='about')
    mc('/issues', controller='front', action='issues')

    # Google webmaster tools verification page
    mc('/googlea26ba8329f727095.html', controller='front', action='blank')

    # This route handles displaying the error page and
    # graphics used in the 404/500
    # error pages. It should likely stay at the top
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    mc("/*url", controller='front', action='catchall')

    return map
示例#4
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)

    mc('/login',    controller='front', action='login')
    mc('/logout',   controller='front', action='logout')
    mc('/adminon',  controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit',   controller='front', action='submit')
    mc('/verifyemail', controller='front', action='verifyemail')

    mc('/imagebrowser', controller='front', action='imagebrowser')
    mc('/imagebrowser/:article', controller='front', action='imagebrowser')

    mc('/validuser',   controller='front', action='validuser')

    mc('/over18',   controller='post', action='over18')

    mc('/search/results', controller='front', action='search_results')

    mc('/about/:location', controller='front',
       action='editreddit', location = 'about')

    mc('/categories/create', controller='front', action='newreddit')
    mc('/categories/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))

    mc('/categories/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))

    #mc('/stats', controller='front', action='stats')
    mc('/user/:username/multiplier', controller='votemultiplier', action='edit')
    mc('/user/:username/:where', controller='user', action='listing',
       where='profile')

    mc('/prefs/:location', controller='front',
       action='prefs', location='options')

    mc('/related/:article/:title', controller='front',
       action = 'related', title=None)
    mc('/lw/:article/:title/:comment', controller='front',
       action= 'comments', title=None, comment = None)
    mc('/edit/:article', controller='front', action="editarticle")


    mc('/stylesheet', controller = 'front', action = 'stylesheet')

    mc('/', controller='promoted', action='listing')

    for name,page in allWikiPagesCached.items():
        if page.has_key('route'):
            mc("/wiki/"+page['route'], controller='wikipage', action='wikipage', name=name)

    mc('/invalidate_cache', controller='wikipage', action='invalidate_cache')

    listing_controllers = "hot|saved|toplinks|topcomments|new|recommended|randomrising|comments|blessed|recentposts|edits|promoted"

    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/dashboard/comments', action='listing', controller='interestingcomments')
    mc('/dashboard/subscribed', action='listing', controller='interestingsubscribed')
    mc('/dashboard/posts', action='listing', controller='interestingposts')

    # Can't use map.resource because the version of the Routing module we're
    # using doesn't support the controller_action kw arg
    #map.resource('meetup', 'meetups', collection_actions=['create', 'new'])
    mc('/meetups/create', action='create', controller='meetups')
    mc('/meetups', action='listing', controller='meetupslisting')
    mc('/meetups/new', action='new', controller='meetups')
    mc('/meetups/:id/edit', action='edit', controller='meetups')
    mc('/meetups/:id/update', action='update', controller='meetups')
    mc('/meetups/:id', action='show', controller='meetups')

    mc('/tag/:tag', controller='tag', action='listing', where='tag')

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))

    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')

    mc('/karma/award', controller='karmaaward', action='award')
    mc('/karma', controller='karmaaward', action='listing')

    mc('/:action', controller='front',
       requirements=dict(action="password|random|framebuster"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog"))

    mc('/:action', controller='toolbar',
       requirements=dict(action="goto|toolbar"))

    mc('/resetpassword/:key', controller='front',
       action='resetpassword')
    mc('/resetpassword', controller='front',
       action='resetpassword')

    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18|optout|optin|login|reg"))

    mc('/api/:action', controller='api')

    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/doquery', controller='query', action='doquery')

    mc('/code', controller='redirect', action='redirect',
       dest='http://code.google.com/p/lesswrong/')

    mc('/about-less-wrong', controller='front', action='about')
    mc('/issues', controller='front', action='issues')

    # Google webmaster tools verification page
    mc('/googlea26ba8329f727095.html', controller='front', action='blank')

    # This route handles displaying the error page and
    # graphics used in the 404/500
    # error pages. It should likely stay at the top
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    mc("/*url", controller='front', action='catchall')

    return map
示例#5
0
文件: routing.py 项目: cmak/reddit
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)
    
    mc('/login',    controller='front', action='login')
    mc('/logout',   controller='front', action='logout')
    mc('/adminon',  controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit',   controller='front', action='submit')
    mc('/validuser',   controller='front', action='validuser')

    mc('/over18',   controller='post', action='over18')
    
    mc('/search', controller='front', action='search')
    
    mc('/about/:location', controller='front', 
       action='editreddit', location = 'about')
    
    mc('/reddits/create', controller='front', action='newreddit')
    mc('/reddits/search', controller='front', action='search_reddits')
    mc('/reddits/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))
    
    mc('/reddits/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))
    
    mc('/buttons', controller='buttons', action='button_demo_page')
    #the frame
    mc('/button_content', controller='buttons', action='button_content')
    #/button.js - the embed
    mc('/button', controller='buttons', action='button_embed')
    
    mc('/widget', controller='buttons', action='widget_demo_page')
    mc('/bookmarklets', controller='buttons', action='bookmarklets')
    
    mc('/stats', controller='front', action='stats')
    
    mc('/feedback', controller='feedback', action='feedback')
    mc('/ad_inq',   controller='feedback', action='ad_inq')
    
    mc('/admin/i18n', controller='i18n', action='list')
    mc('/admin/i18n/:action', controller='i18n')
    mc('/admin/i18n/:action/:lang', controller='i18n')
    
    mc('/user/:username/:location', controller='front', action='user',
       location='overview')
    
    mc('/prefs/:location', controller='front',
       action='prefs', location='options')
    
    mc('/info/0:name/*rest', controller = 'front', action='oldinfo')
    
    mc('/info/:article/comments/:comment',
       controller='front', action='comments',
       comment = None)
    mc('/info/:article/related', controller='front',
       action = 'related')
    mc('/info/:article/details', controller='front',
       action = 'details')
    
    mc('/', controller='hot', action='listing')
    
    listing_controllers = "hot|saved|toplinks|new|recommended|normalized"
    
    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))
    
    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')
    
    mc('/:action', controller='front',
       requirements=dict(action="password|random"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog"))
    mc('/help/:anything', controller='embed', action='help')
    
    mc('/:action', controller='toolbar',
       requirements=dict(action="goto|toolbar"))
    
    mc('/resetpassword/:key', controller='front',
       action='resetpassword')
    mc('/resetpassword', controller='front',
       action='resetpassword')
    
    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18"))
    
    mc('/api/:action', controller='api')
    mc('/d/:what', controller='api', action='bookmarklet')
    
    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/store', controller='redirect', action='redirect',
       dest='http://store.reddit.com/index.html')
    
    # This route handles displaying the error page and 
    # graphics used in the 404/500
    # error pages. It should likely stay at the top 
    # to ensure that the error page is
    # displayed properly.
    mc('error/:action/:id', controller='error')
    
    return map
示例#6
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)
    
    mc('/login',    controller='front', action='login')
    mc('/logout',   controller='front', action='logout')
    mc('/verify',    controller='front', action='verify')
    mc('/adminon',  controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit',   controller='front', action='submit')
    mc('/validuser',   controller='front', action='validuser')

    mc('/over18',   controller='post', action='over18')
    
    mc('/search', controller='front', action='search')

    mc('/sup', controller='front', action='sup')
    mc('/traffic', controller='front', action='site_traffic')
    
    mc('/about/:location', controller='front', 
       action='editdigg', location = 'about')
    
    mc('/diggs/create', controller='front', action='newreddit')
    mc('/diggs/search', controller='front', action='search_reddits')
    mc('/diggs/login', controller='front', action='login')
    mc('/diggs/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))

    mc('/diggs/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))
    
    mc('/buttons', controller='buttons', action='button_demo_page')
    #the frame
    mc('/button_content', controller='buttons', action='button_content')
    #/button.js and buttonlite.js - the embeds
    mc('/button', controller='buttons', action='button_embed')
    mc('/buttonlite', controller='buttons', action='button_lite')
    
    mc('/widget', controller='buttons', action='widget_demo_page')
    mc('/bookmarklets', controller='buttons', action='bookmarklets')
    
    mc('/awards', controller='front', action='awards')
    
    mc('/i18n', controller='feedback', action='i18n')
    mc('/feedback', controller='feedback', action='feedback')
    mc('/ad_inq',   controller='feedback', action='ad_inq')
    

    mc('/admin/i18n', controller='i18n', action='list')
    mc('/admin/i18n/:action', controller='i18n')
    mc('/admin/i18n/:action/:lang', controller='i18n')

    mc('/admin/awards', controller='awards')
    mc('/admin/awards/:awardcn/:action', controller='awards',
       requirements=dict(action="give|winners"))

    mc('/admin/:action', controller='admin')
    
    mc('/user/:username/about', controller='user', action='about',
       where='overview')
    mc('/user/:username/:where', controller='user', action='listing',
       where='overview')
    
    mc('/prefs/:location', controller='front',
       action='prefs', location='options')
    
    mc('/info/0:article/*rest', controller = 'front', 
       action='oldinfo', dest='comments', type='ancient')
    mc('/info/:article/:dest/:comment', controller='front',
       action='oldinfo', type='old', dest='comments', comment=None)

    mc('/related/:article/:title', controller='front',
       action = 'related', title=None)
    mc('/details/:article/:title', controller='front',
       action = 'details', title=None)
    mc('/traffic/:article/:title', controller='front',
       action = 'traffic', title=None)
    mc('/shirt/:article/:title', controller='front',
       action = 'shirt', title=None)
    mc('/comments/:article/:title/:comment', controller='front', 
       action = 'comments', title=None, comment = None)
    mc('/duplicates/:article/:title', controller = 'front',
       action = 'duplicates', title=None)
    
    mc('/mail/optout', controller='front', action = 'optout')
    mc('/mail/optin',  controller='front', action = 'optin')
    mc('/stylesheet', controller = 'front', action = 'stylesheet')
    mc('/frame', controller='front', action = 'frame')
    mc('/framebuster/:blah', controller='front', action = 'framebuster')
    mc('/framebuster/:what/:blah',
       controller='front', action = 'framebuster')

    mc('/promoted/edit_promo/:link',
       controller='promote', action = 'edit_promo')
    mc('/promoted/pay/:link',
       controller='promote', action = 'pay')
    mc('/promoted/graph',
       controller='promote', action = 'graph')
    mc('/promoted/:action', controller='promote',
       requirements = dict(action = "new_promo"))
    mc('/promoted/:sort', controller='promote', action = "listing")
    mc('/promoted/', controller='promoted', action = "listing",
       sort = "")

    mc('/health', controller='health', action='health')
    mc('/shutdown', controller='health', action='shutdown')

    mc('/', controller='hot', action='listing')
    
    listing_controllers = "hot|saved|toplinks|new|recommended|randomrising|comments"

    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))
    
    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')
    
    mc('/:action', controller='front',
       requirements=dict(action="password|random|framebuster"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog"))
    mc('/help/*anything', controller='embed', action='help')
    
    mc('/goto', controller='toolbar', action='goto')
    mc('/tb/:id', controller='toolbar', action='tb')
    mc('/toolbar/:action', controller='toolbar',
       requirements=dict(action="toolbar|inner|login"))
    mc('/toolbar/comments/:id', controller='toolbar', action='comments')

    mc('/c/:comment_id', controller='front', action='comment_by_id')

    mc('/s/*rest', controller='toolbar', action='s')
    # additional toolbar-related rules just above the catchall

    mc('/d/:what', controller='api', action='bookmarklet')
    
    mc('/resetpassword/:key', controller='front',
       action='resetpassword')
    mc('/verification/:key', controller='front',
       action='verify_email')
    mc('/resetpassword', controller='front',
       action='resetpassword')

    mc('/post/:action/:url_user', controller='post',
       requirements=dict(action="login|reg"))
    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18|unlogged_options|optout|optin|login|reg"))
    
    mc('/api/distinguish/:how', controller='api', action="distinguish")
    mc('/api/:action/:url_user', controller='api',
       requirements=dict(action="login|register"))
    mc('/api/gadget/click/:ids', controller = 'api', action='gadget', type='click')
    mc('/api/gadget/:type', controller = 'api', action='gadget')
    mc('/api/:action', controller='promote',
       requirements=dict(action="promote|unpromote|new_promo|link_thumb|freebie|promote_note|update_pay|refund|traffic_viewer|rm_traffic_viewer"))
    mc('/api/:action', controller='api')
    
    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/mediaembed/:link', controller="mediaembed", action="mediaembed")

    mc('/doquery', controller='query', action='doquery')

    mc('/store', controller='redirect', action='redirect',
       dest='http://store.digg.com/index.html')
    
    mc('/code', controller='redirect', action='redirect',
       dest='http://code.digg.com/')
    
    mc('/mobile', controller='redirect', action='redirect',
       dest='http://m.digg.com/')

    mc('/authorize_embed', controller = 'front', action = 'authorize_embed')
    
    mc("/ads/", controller = "front", action = "ad")
    mc("/ads/:digg", controller = "front", action = "ad")
    # This route handles displaying the error page and 
    # graphics used in the 404/500
    # error pages. It should likely stay at the top 
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    # these should be near the buttom, because they should only kick
    # in if everything else fails. It's the attempted catch-all
    # digg.com/http://... and reddit.com/34fr, but these redirect to
    # the less-guessy versions at /s/ and /tb/
    mc('/:linkoid', controller='toolbar', action='linkoid',
       requirements=dict(linkoid='[0-9a-z]{1,6}'))
    mc('/:urloid', controller='toolbar', action='urloid',
       requirements=dict(urloid=r'(\w+\.\w{2,}|https?).*'))

    mc("/*url", controller='front', action='catchall')

    return map
示例#7
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)
    
    mc('/login',    controller='front', action='login')
    mc('/logout',   controller='front', action='logout')
    mc('/adminon',  controller='front', action='adminon')
    mc('/adminoff', controller='front', action='adminoff')
    mc('/submit',   controller='front', action='submit')
    mc('/validuser',   controller='front', action='validuser')

    mc('/over18',   controller='post', action='over18')
    
    mc('/search', controller='front', action='search')

    mc('/sup', controller='front', action='sup')
    mc('/traffic', controller='front', action='site_traffic')
    
    mc('/about/:location', controller='front', 
       action='editreddit', location = 'about')
    
    mc('/reddits/create', controller='front', action='newreddit')
    mc('/reddits/search', controller='front', action='search_reddits')
    mc('/reddits/:where', controller='reddits', action='listing',
       where = 'popular',
       requirements=dict(where="popular|new|banned"))

    mc('/reddits/mine/:where', controller='myreddits', action='listing',
       where='subscriber',
       requirements=dict(where='subscriber|contributor|moderator'))
    
    mc('/buttons', controller='buttons', action='button_demo_page')
    #the frame
    mc('/button_content', controller='buttons', action='button_content')
    #/button.js and buttonlite.js - the embeds
    mc('/button', controller='buttons', action='button_embed')
    mc('/buttonlite', controller='buttons', action='button_lite')
    
    mc('/widget', controller='buttons', action='widget_demo_page')
    mc('/bookmarklets', controller='buttons', action='bookmarklets')
    
    mc('/stats', controller='front', action='stats')
    
    mc('/feedback', controller='feedback', action='feedback')
    mc('/ad_inq',   controller='feedback', action='ad_inq')
    

    mc('/admin/i18n', controller='i18n', action='list')
    mc('/admin/i18n/:action', controller='i18n')
    mc('/admin/i18n/:action/:lang', controller='i18n')

    mc('/admin/:action', controller='admin')
    
    mc('/user/:username/about', controller='user', action='about',
       where='overview')
    mc('/user/:username/:where', controller='user', action='listing',
       where='overview')
    
    mc('/prefs/:location', controller='front',
       action='prefs', location='options')
    
    mc('/info/0:article/*rest', controller = 'front', 
       action='oldinfo', dest='comments', type='ancient')
    mc('/info/:article/:dest/:comment', controller='front',
       action='oldinfo', type='old', dest='comments', comment=None)

    mc('/related/:article/:title', controller='front',
       action = 'related', title=None)
    mc('/details/:article/:title', controller='front',
       action = 'details', title=None)
    mc('/traffic/:article/:title', controller='front',
       action = 'traffic', title=None)
    mc('/shirt/:article/:title', controller='front',
       action = 'shirt', title=None)
    mc('/comments/:article/:title/:comment', controller='front', 
       action = 'comments', title=None, comment = None)
    mc('/duplicates/:article/:title', controller = 'front',
       action = 'duplicates', title=None)
    
    mc('/mail/optout', controller='front', action = 'optout')
    mc('/mail/optin',  controller='front', action = 'optin')
    mc('/stylesheet', controller = 'front', action = 'stylesheet')
    mc('/frame', controller='front', action = 'frame')
    mc('/framebuster/:blah', controller='front', action = 'framebuster')
    mc('/framebuster/:what/:blah',
       controller='front', action = 'framebuster')

    mc('/promote/edit_promo/:link', controller='promote', action = 'edit_promo')
    mc('/promote/:action', controller='promote')

    mc('/', controller='upcoming', action='listing')
    
    listing_controllers = "hot|saved|toplinks|new|upcoming|recommended|randomrising|comments"

    mc('/:controller', action='listing',
       requirements=dict(controller=listing_controllers))

    mc('/by_id/:names', controller='byId', action='listing')

    mc('/:sort', controller='browse', sort='top', action = 'listing',
       requirements = dict(sort = 'top|controversial'))
    
    mc('/message/compose', controller='message', action='compose')
    mc('/message/:where', controller='message', action='listing')
    
    mc('/:action', controller='front',
       requirements=dict(action="password|random|framebuster"))
    mc('/:action', controller='embed',
       requirements=dict(action="help|blog"))
    mc('/help/:anything', controller='embed', action='help')
    
    mc('/goto', controller='toolbar', action='goto')
    mc('/tb/:id', controller='toolbar', action='tb')
    mc('/toolbar/:action', controller='toolbar',
       requirements=dict(action="toolbar|inner|login"))
    mc('/toolbar/comments/:id', controller='toolbar', action='comments')

    mc('/s/*rest', controller='toolbar', action='s')
    # additional toolbar-related rules just above the catchall

    mc('/d/:what', controller='api', action='bookmarklet')
    
    mc('/resetpassword/:key', controller='front',
       action='resetpassword')
    mc('/resetpassword', controller='front',
       action='resetpassword')

    mc('/post/:action/:url_user', controller='post',
       requirements=dict(action="login|reg"))
    mc('/post/:action', controller='post',
       requirements=dict(action="options|over18|unlogged_options|optout|optin|login|reg"))
    
    mc('/api/distinguish/:how', controller='api', action="distinguish")
    mc('/api/:action/:url_user', controller='api',
       requirements=dict(action="login|register"))
    mc('/api/gadget/click/:ids', controller = 'api', action='gadget', type='click')
    mc('/api/gadget/:type', controller = 'api', action='gadget')
    mc('/api/:action', controller='api')
    
    mc('/captcha/:iden', controller='captcha', action='captchaimg')

    mc('/mediaembed/:link', controller="mediaembed", action="mediaembed")

    mc('/doquery', controller='query', action='doquery')

    mc('/store', controller='redirect', action='redirect',
       dest='http://store.reddit.com/index.html')
    
    mc('/code', controller='redirect', action='redirect',
       dest='http://code.reddit.com/')
    
    mc('/mobile', controller='redirect', action='redirect',
       dest='http://m.reddit.com/')

    mc('/authorize_embed', controller = 'front', action = 'authorize_embed')
    
    # This route handles displaying the error page and 
    # graphics used in the 404/500
    # error pages. It should likely stay at the top 
    # to ensure that the error page is
    # displayed properly.
    mc('/error/document/:id', controller='error', action="document")

    # these should be near the buttom, because they should only kick
    # in if everything else fails. It's the attempted catch-all
    # reddit.com/http://... and reddit.com/34fr, but these redirect to
    # the less-guessy versions at /s/ and /tb/
    mc('/:linkoid', controller='toolbar', action='linkoid',
       requirements=dict(linkoid='[0-9a-z]{1,6}'))
    mc('/:urloid', controller='toolbar', action='urloid',
       requirements=dict(urloid=r'(\w+\.\w{2,}|https?).*'))

    mc("/*url", controller='front', action='catchall')

    return map
示例#8
0
def make_map(global_conf={}, app_conf={}):
    map = Mapper()
    mc = map.connect

    admin_routes.add(mc)

    mc("/login", controller="forms", action="login")
    mc("/register", controller="forms", action="register")
    mc("/logout", controller="forms", action="logout")
    mc("/verify", controller="forms", action="verify")
    mc("/adminon", controller="forms", action="adminon")
    mc("/adminoff", controller="forms", action="adminoff")
    mc("/submit", controller="front", action="submit")
    mc("/validuser", controller="forms", action="validuser")

    mc("/over18", controller="post", action="over18")

    mc("/search", controller="front", action="search")

    mc("/sup", controller="front", action="sup")
    mc("/traffic", controller="front", action="site_traffic")

    mc("/about/message/:where", controller="message", action="listing")
    mc("/about/:location", controller="front", action="editreddit", location="about")

    mc("/reddits/create", controller="front", action="newreddit")
    mc("/reddits/search", controller="front", action="search_reddits")
    mc("/reddits/login", controller="forms", action="login")
    mc(
        "/reddits/:where",
        controller="reddits",
        action="listing",
        where="popular",
        requirements=dict(where="popular|new|banned"),
    )

    mc(
        "/reddits/mine/:where",
        controller="myreddits",
        action="listing",
        where="subscriber",
        requirements=dict(where="subscriber|contributor|moderator"),
    )

    mc("/buttons", controller="buttons", action="button_demo_page")
    mc("/upgradebuttons", controller="buttons", action="upgrade_buttons")
    # the frame
    mc("/button_content", controller="buttons", action="button_content")
    # /button.js and buttonlite.js - the embeds
    mc("/button", controller="buttonjs", action="button_embed")
    mc("/buttonlite", controller="buttons", action="button_lite")

    mc("/widget", controller="buttons", action="widget_demo_page")
    mc("/bookmarklets", controller="buttons", action="bookmarklets")
    mc("/iphonebookmarklet", controller="buttons", action="iphonebookmarklets")

    mc("/awards", controller="front", action="awards")

    mc("/i18n", controller="feedback", action="i18n")
    mc("/feedback", controller="feedback", action="feedback")
    mc("/ad_inq", controller="feedback", action="ad_inq")

    mc("/admin/i18n", controller="i18n", action="list")
    mc("/admin/i18n/:action", controller="i18n")
    mc("/admin/i18n/:action/:lang", controller="i18n")

    mc("/admin/usage", controller="usage")

    # Used for editing ads
    mc("/admin/ads", controller="ads")
    mc("/admin/ads/:adcn/:action", controller="ads", requirements=dict(action="assign|srs"))

    mc("/admin/awards", controller="awards")
    mc("/admin/awards/:awardcn/:action", controller="awards", requirements=dict(action="give|winners"))

    mc("/admin/errors", controller="errorlog")

    mc("/admin/:action", controller="admin")

    mc("/user/:username/about", controller="user", action="about", where="overview")
    mc("/user/:username/:where", controller="user", action="listing", where="overview")

    mc("/prefs/:location", controller="forms", action="prefs", location="options")

    mc("/depmod", controller="forms", action="depmod")

    mc("/info/0:article/*rest", controller="front", action="oldinfo", dest="comments", type="ancient")
    mc("/info/:article/:dest/:comment", controller="front", action="oldinfo", type="old", dest="comments", comment=None)

    mc("/related/:article/:title", controller="front", action="related", title=None)
    mc("/details/:article/:title", controller="front", action="details", title=None)
    mc("/traffic/:article/:title", controller="front", action="traffic", title=None)
    mc("/comments/:article/:title/:comment", controller="front", action="comments", title=None, comment=None)
    mc("/duplicates/:article/:title", controller="front", action="duplicates", title=None)

    mc("/mail/optout", controller="forms", action="optout")
    mc("/mail/optin", controller="forms", action="optin")
    mc("/stylesheet", controller="front", action="stylesheet")
    mc("/frame", controller="front", action="frame")
    mc("/framebuster/:blah", controller="front", action="framebuster")
    mc("/framebuster/:what/:blah", controller="front", action="framebuster")

    mc("/promoted/edit_promo/:link", controller="promote", action="edit_promo")
    mc("/promoted/pay/:link/:indx", controller="promote", action="pay")
    mc("/promoted/graph", controller="promote", action="graph")
    mc("/promoted/:action", controller="promote", requirements=dict(action="edit_promo|new_promo|roadblock"))
    mc("/promoted/:sort", controller="promote", action="listing")
    mc("/promoted/", controller="promoted", action="listing", sort="")

    mc("/health", controller="health", action="health")
    mc("/health/:action", controller="health", requirements=dict(action="threads|dump|sleep"))
    mc("/shutdown", controller="health", action="shutdown")

    mc("/", controller="hot", action="listing")

    listing_controllers = "hot|saved|new|randomrising|comments"

    mc("/:controller", action="listing", requirements=dict(controller=listing_controllers))

    mc("/by_id/:names", controller="byId", action="listing")

    mc("/:sort", controller="browse", sort="top", action="listing", requirements=dict(sort="top|controversial"))

    mc("/message/compose", controller="message", action="compose")
    mc("/message/messages/:mid", controller="message", action="listing", where="messages")
    mc("/message/:where", controller="message", action="listing")
    mc("/message/moderator/:subwhere", controller="message", action="listing", where="moderator")

    mc("/thanks", controller="forms", action="thanks", secret="")
    mc("/thanks/:secret", controller="forms", action="thanks")

    mc("/gold", controller="forms", action="gold")

    mc("/password", controller="forms", action="password")
    mc("/:action", controller="front", requirements=dict(action="random|framebuster|selfserviceoatmeal"))
    mc("/:action", controller="embed", requirements=dict(action="help|blog|faq"))
    mc("/help/*anything", controller="embed", action="help")

    mc("/goto", controller="toolbar", action="goto")
    mc("/tb/:id", controller="toolbar", action="tb")
    mc("/toolbar/:action", controller="toolbar", requirements=dict(action="toolbar|inner|login"))
    mc("/toolbar/comments/:id", controller="toolbar", action="comments")

    mc("/c/:comment_id", controller="front", action="comment_by_id")

    mc("/s/*rest", controller="toolbar", action="s")
    # additional toolbar-related rules just above the catchall

    mc("/d/:what", controller="api", action="bookmarklet")

    mc("/resetpassword/:key", controller="forms", action="resetpassword")
    mc("/verification/:key", controller="forms", action="verify_email")
    mc("/resetpassword", controller="forms", action="resetpassword")

    mc("/post/:action/:url_user", controller="post", requirements=dict(action="login|reg"))
    mc(
        "/post/:action",
        controller="post",
        requirements=dict(action="options|over18|unlogged_options|optout|optin|login|reg"),
    )

    mc("/api/distinguish/:how", controller="api", action="distinguish")
    # wherever this is, google has to agree.
    mc("/api/gcheckout", controller="ipn", action="gcheckout")
    mc("/api/spendcreddits", controller="ipn", action="spendcreddits")
    mc("/api/ipn/:secret", controller="ipn", action="ipn")
    mc("/ipn/:secret", controller="ipn", action="ipn")
    mc("/api/:action/:url_user", controller="api", requirements=dict(action="login|register"))
    mc("/api/gadget/click/:ids", controller="api", action="gadget", type="click")
    mc("/api/gadget/:type", controller="api", action="gadget")
    mc(
        "/api/:action",
        controller="promote",
        requirements=dict(
            action="promote|unpromote|edit_promo|link_thumb|freebie|promote_note|update_pay|refund|traffic_viewer|rm_traffic_viewer|edit_campaign|delete_campaign|meta_promo|add_roadblock|rm_roadblock"
        ),
    )
    mc("/api/:action", controller="apiminimal", requirements=dict(action="onload|new_captcha"))
    mc("/api/:action", controller="api")

    mc("/button_info", controller="api", action="info", limit=1)

    mc("/captcha/:iden", controller="captcha", action="captchaimg")

    mc("/mediaembed/:link", controller="mediaembed", action="mediaembed")

    mc("/doquery", controller="query", action="doquery")

    mc("/store", controller="redirect", action="redirect", dest="http://store.reddit.com/index.html")

    mc("/code", controller="redirect", action="redirect", dest="http://code.reddit.com/")

    mc("/mobile", controller="redirect", action="redirect", dest="http://m.reddit.com/")

    mc("/authorize_embed", controller="front", action="authorize_embed")

    # Used for showing ads
    mc("/ads/", controller="ad", action="ad")
    mc("/ads/r/:reddit_name", controller="ad", action="ad")
    mc("/ads/:codename", controller="ad", action="ad_by_codename")

    mc("/try", controller="forms", action="try_compact")
    mc("/comscore-iframe/", controller="mediaembed", action="comscore")
    mc("/comscore-iframe/*url", controller="mediaembed", action="comscore")

    # This route handles displaying the error page and
    # graphics used in the 404/500
    # error pages. It should likely stay at the top
    # to ensure that the error page is
    # displayed properly.
    mc("/error/document/:id", controller="error", action="document")

    # these should be near the buttom, because they should only kick
    # in if everything else fails. It's the attempted catch-all
    # reddit.com/http://... and reddit.com/34fr, but these redirect to
    # the less-guessy versions at /s/ and /tb/
    mc("/:linkoid", controller="toolbar", action="linkoid", requirements=dict(linkoid="[0-9a-z]{1,6}"))
    mc("/:urloid", controller="toolbar", action="urloid", requirements=dict(urloid=r"(\w+\.\w{2,}|https?).*"))

    mc("/*url", controller="front", action="catchall")

    return map