Ticket #1517: bug-redirect.patch

File bug-redirect.patch, 1.2 KB (added by dreid, 11 years ago)
  • twisted-web/twisted-web

     
    1010from twisted.internet import app
    1111from twisted.python import filepath
    1212
     13class BugsRedirect(twutil.Redirect):
     14    def __init__(self):
     15        twutil.Redirect.__init__(self, '/trac/report')
     16       
     17    def getChild(self, name, request):
     18        if name.startswith('issue'):
     19            return twutil.Redirect('/trac/ticket/%s' % (name[5:],))
     20
     21        return twutil.Redirect.getChild(self, name, request)
     22
    1323# Add useful extra extension -> content-type mapping entries
    1424static.File.contentTypes['.tac'] = 'text/plain'
    1525
     
    5969# These are only on (www.)twistedmatrix.com
    6070tm.putChild('buildbot', distrib.ResourceSubscription('unix', '/home/buildbot/.twistd-web-pb'))
    6171#tm.putChild('bugs', proxy.ReverseProxyResource('twistedmatrix.com', 8085, '/twisted'))
    62 tm.putChild('bugs', twutil.Redirect('/trac/report'))
     72tm.putChild('bugs', BugRedirect())
    6373tm.putChild('trac', proxy.ReverseProxyResource('twistedmatrix.com', 9881, '/trac'))
    6474
    6575tm.putChild('twisted', twutil.ChildRedirector('http://twistedmatrix.com/bugs/'))