author Till Schneidereit <tschneidereit@gmail.com>
Fri, 30 Nov 2012 15:21:49 +0100
changeset 69 d2f36f9b40d9f6c003008979c56126049b7f738a
parent 33 6967ba3e20f478941484f84afdad6bf707d156a7
permissions -rw-r--r--
Register the default http handler for all schemes we handle to force them to be non-local This is a workaround for a breaking change in hg 2.4

# std python modules
import urllib2
  import cStringIO as StringIO
except ImportError:
  import StringIO
import os

class Handler(urllib2.BaseHandler):
  def __init__(self, ui, passmgr):
    self.ui = ui
    self.passmgr = passmgr

    self.base = ui.config('qimportbz', 'pastebin',
                          os.environ.get('PASTEBIN', "pastebin.mozilla.org"))

  # Change the request to the http to fetch the raw text
  def pb_open(self, req):
    url = "http://%s/?dl=%s" % (self.base, req.get_host())
    return self.parent.open(url)