示例#1
0
def sets():
    set_ids = savant.sets.all(g.db)
    sets = []
    for set_id in set_ids:
        set_obj = savant.sets.Set(g.db, set_id)

        comparisons = []
        other_sets = []

        for diff_id in set_obj.get_diff_ids():
            diff = savant.diffs.Diff(diff_id)
            comparisons.extend(savant.comparisons.find_with_diff(diff, g.db))
            other_sets.extend(savant.sets.find_with_diff(diff, g.db))

        comparisons = sorted(list(set(comparisons)))

        other_sets = sorted(list(set(other_sets)))
        other_sets.remove(set_id)
        other_sets = [savant.sets.Set(g.db, s) for s in other_sets]

        data = {
                'set': set_obj,
                'comparisons': comparisons,
                'other_sets': other_sets,
                }
        sets.append(data)
    return render_template('sets.html', sets=sets)
示例#2
0
文件: savant_web.py 项目: Doveps/mono
def sets():
    set_ids = savant.sets.all(g.db)
    sets = []
    for set_id in set_ids:
        set_obj = savant.sets.Set(g.db, set_id)

        comparisons = []
        other_sets = []

        for diff_id in set_obj.get_diff_ids():
            diff = savant.diffs.Diff(diff_id)
            comparisons.extend(savant.comparisons.find_with_diff(diff, g.db))
            other_sets.extend(savant.sets.find_with_diff(diff, g.db))

        comparisons = sorted(list(set(comparisons)))

        other_sets = sorted(list(set(other_sets)))
        other_sets.remove(set_id)
        other_sets = [savant.sets.Set(g.db, s) for s in other_sets]

        data = {
            'set': set_obj,
            'comparisons': comparisons,
            'other_sets': other_sets,
        }
        sets.append(data)
    return render_template('sets.html', sets=sets)
示例#3
0
文件: savant_web.py 项目: Doveps/mono
def set_edit(escaped_id=None):
    set_id = urllib.unquote(escaped_id)
    dform = forms.DDiffForm(g.db, set_id)
    set_obj = dform.set_obj

    comparisons = []
    for diff_id in set_obj.get_diff_ids():
        diff = savant.diffs.Diff(diff_id)
        comparisons.extend(savant.comparisons.find_with_diff(diff, g.db))
    comparisons = sorted(list(set(comparisons)))
    comparisons = [savant.comparisons.Comparison(g.db, c) for c in comparisons]

    return render_template('set.html',
                           set=set_obj,
                           comparisons=comparisons,
                           form=dform.form)
示例#4
0
def set_edit(escaped_id=None):
    set_id = urllib.unquote(escaped_id)
    dform = forms.DDiffForm(g.db, set_id)
    set_obj = dform.set_obj

    comparisons = []
    for diff_id in set_obj.get_diff_ids():
        diff = savant.diffs.Diff(diff_id)
        comparisons.extend(savant.comparisons.find_with_diff(diff, g.db))
    comparisons = sorted(list(set(comparisons)))
    comparisons = [savant.comparisons.Comparison(g.db, c) for c in comparisons]

    return render_template(
            'set.html',
            set = set_obj,
            comparisons = comparisons,
            form = dform.form)