Meta program for serving a single file. Useful for favicon.ico and robots.txt

def SingleStaticServe(file_path):
    """
    Meta program for serving a single file. Useful for favicon.ico and robots.txt
    """
    def get_file():
        mime, encoding = mimetypes.guess_type(file_path)
        fullpath = os.path.join(get_config('project_path'), file_path)
        return open(fullpath, 'rb'), mime or 'application/octet-stream'

    class SingleStaticServe(Program):
        controllers = ['http-get']
        model = [get_file]
        view = FileView()

    return SingleStaticServe()