root/galaxy-central/eggs/twill-0.9-py2.6.egg/twill/other_packages/_mechanize_dist/_debug.py

リビジョン 3, 0.9 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1import logging
2
3from urllib2 import BaseHandler
4from _response import response_seek_wrapper
5
6
7class HTTPResponseDebugProcessor(BaseHandler):
8    handler_order = 900  # before redirections, after everything else
9
10    def http_response(self, request, response):
11        if not hasattr(response, "seek"):
12            response = response_seek_wrapper(response)
13        info = logging.getLogger("mechanize.http_responses").info
14        try:
15            info(response.read())
16        finally:
17            response.seek(0)
18        info("*****************************************************")
19        return response
20
21    https_response = http_response
22
23class HTTPRedirectDebugProcessor(BaseHandler):
24    def http_request(self, request):
25        if hasattr(request, "redirect_dict"):
26            info = logging.getLogger("mechanize.http_redirects").info
27            info("redirecting to %s", request.get_full_url())
28        return request
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。