def view_file(path, root):
    file_suffix = os.path.splitext(path)[1]

    parent_dir = os.path.abspath(os.path.join(path, os.pardir))

    files_in_dir = filter(
        lambda x: os.path.splitext(x)[1] != ".resources" and x[0] != '.',
        os.listdir(parent_dir))

    files_in_dir.sort()

    file_index = files_in_dir.index(os.path.relpath(path, parent_dir))

    def make_path_struct(filename):
        path_dict = {
            "name" : os.path.splitext(filename)[0],
            "link" : '/'.join(("/view", os.path.relpath(parent_dir, root),
                               filename))
            }

        return path_dict

    if file_index > 0:
        prev_path = make_path_struct(files_in_dir[file_index - 1])
    else:
        prev_path = None

    if len(files_in_dir) - 1 < file_index:
        next_path = make_path_struct(files_in_dir[file_index + 1])
    else:
        next_path = None

    if file_suffix not in markup_file_suffixes:
        return static_file(path, root="/")

    converter_bin = os.path.abspath(config.get(
            "markupserve", "converter_binary"))

    command = shlex.split('%s "%s"' % (converter_bin, path))

    render_process = subprocess.Popen(command, stdout=subprocess.PIPE,
                                      stderr=subprocess.PIPE)

    (output, error) = render_process.communicate()

    if render_process.returncode != 0:
        abort(500, "Conversion of '%s' failed with error %d: %s %s"
              % (path, render_process.returncode, output, error))

    template = jinja_env.get_template("file.jinja")

    filename = os.path.splitext(os.path.basename(path))[0]

    parent_path = "/view/" + os.path.relpath(parent_dir, root)

    # Get rid of any Unicode garbage that Jinja might choke on
    output = output.decode("utf-8")

    return template.render(
        filename=filename, last_modified=os.path.getmtime(path), content=output,
        parent=parent_path, prev=prev_path, next=next_path)
dataset/ETHPy150Open alexras/markupserve/markupserve.py/view_file/swapped operands of `<`