from .tool.func import * def diff_data_2(conn, name): curs = conn.cursor() first = flask.request.args.get('first', '1') second = flask.request.args.get('second', '1') curs.execute("select data from history where id = ? and title = ?", [first, name]) first_raw_data = curs.fetchall() if first_raw_data: curs.execute("select data from history where id = ? and title = ?", [second, name]) second_raw_data = curs.fetchall() if second_raw_data: first_data = html.escape(first_raw_data[0][0]) second_data = html.escape(second_raw_data[0][0]) if first == second: result = '-' else: diff_data = difflib.SequenceMatcher(None, first_data, second_data) result = re.sub('\r', '', diff(diff_data)) return easy_minify(flask.render_template(skin_check(), imp = [name, wiki_set(), custom(), other2([' (' + load_lang('compare') + ')', 0])], data = '
' + result + '
', menu = [['history/' + url_pas(name), load_lang('return')]] )) return redirect('/history/' + url_pas(name))