def toggle_breakpoint():
    "Set or clear a breakpoint"

    lineno = None
    ok = None
    try:
        filename = os.path.join(request.env['applications_parent'],
                                'applications', request.vars.filename)
        # normalize path name: replace slashes, references, etc...
        filename = os.path.normpath(os.path.normcase(filename))
        if not request.vars.data:
            # ace send us the line number!
            lineno = int(request.vars.sel_start) + 1
        else:
            # editarea send us the offset, manually check the cursor pos
            start = 0
            sel_start = int(request.vars.sel_start)
            for lineno, line in enumerate(request.vars.data.split("\n")):
                if start <= sel_start:
                    break
                start += len(line) + 1
            else:
                lineno = None
        if lineno is not None:
            for bp in qdb_debugger.do_list_breakpoint():
                no, bp_filename, bp_lineno, temporary, enabled, hits, cond = bp
                # normalize path name: replace slashes, references, etc...
                bp_filename = os.path.normpath(os.path.normcase(bp_filename))
                if filename == bp_filename and lineno == bp_lineno:
                    err = qdb_debugger.do_clear_breakpoint(filename, lineno)
                    response.flash = T("Removed Breakpoint on %s at line %s", (
                        filename, lineno))
                    ok = False
                    break
            else:
                err = qdb_debugger.do_set_breakpoint(filename, lineno)
                response.flash = T("Set Breakpoint on %s at line %s: %s") % (
                    filename, lineno, err or T('successful'))
                ok = True
        else:
            response.flash = T("Unable to determine the line number!")
    except Exception, e:
        session.flash = str(e)
    return response.json({'ok': ok, 'lineno': lineno})
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/applications/admin/controllers/debug.py/toggle_breakpoint/swapped operands of `<=`