browser/components/payments/server.py
author Maliha Islam <mislam@mozilla.com>
Tue, 02 Jul 2019 15:47:34 +0000
changeset 540635 6b9d711108403a4f94701e3f2c5083915d6c9055
parent 473813 02159d1ec622088538ee4a5d1d9af5043e8c787f
child 542640 3d59cb02b6ff3ad4d51636346076e4a0123acec3
permissions -rw-r--r--
Bug 1559975 - Make directories python3 compatible r=catlee Differential Revision: https://phabricator.services.mozilla.com/D35257

from __future__ import absolute_import
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler


class RequestHandler(SimpleHTTPRequestHandler, object):
    def translate_path(self, path):
        # Map autofill paths to their own directory
        autofillPath = "/formautofill"
        if (path.startswith(autofillPath)):
            path = "browser/extensions/formautofill/content" + \
                path[len(autofillPath):]
        else:
            path = "browser/components/payments/res" + path

        return super(RequestHandler, self).translate_path(path)


if __name__ == '__main__':
    BaseHTTPServer.test(RequestHandler, BaseHTTPServer.HTTPServer)