pb.py
author Steve Fink <sfink@mozilla.com>
Thu, 05 Sep 2013 10:41:19 -0700
changeset 78 9c5006e8d531
parent 33 6967ba3e20f4
permissions -rw-r--r--
Bug 913083 - Use an accessor for the "main" imported patch, r=jdm

# std python modules
import urllib2
try:
  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)