Code Duplication    Length = 9-10 lines in 2 locations

spike/views/sandbox.py 1 location

@@ 119-128 (lines=10) @@
116
117
    cpt = 0
118
    named = list()
119
    while "id{}".format(cpt) in nxdic:
120
        _id = "id{}".format(cpt)
121
        _var_name = "var_name{}".format(cpt)
122
        _zone = "zone{}".format(cpt)
123
        if "var_name{}".format(cpt) in nxdic:
124
            named.append("id <strong>{}</strong> in var named <strong>{}</strong> of zone <strong>{}</strong>".format(
125
                nxdic[_id], nxdic[_var_name], nxdic[_zone]))
126
        else:
127
            named.append("id <strong>{}</strong> in zone <strong>{}</strong>".format(nxdic[_id], nxdic[_zone]))
128
        cpt += 1
129
    explain += ' and '.join(named)
130
131
    return render_template("misc/sandbox.html", nxlog_explaination=explain, nxlog=nxlog)

spike/views/whitelists.py 1 location

@@ 93-101 (lines=9) @@
90
            nxdic[key] = value[0]
91
92
        cpt = 0
93
        while "id{}".format(cpt) in nxdic:
94
            _id = "id{}".format(cpt)
95
            _var_name = "var_name{}".format(cpt)
96
            _zone = "zone{}".format(cpt)
97
            if "var_name{}".format(cpt) in nxdic:
98
                whitelist.append('BasicRule wl:{} "mz:{}:{}"'.format(nxdic[_id], nxdic[_var_name], nxdic[_zone]))
99
            else:
100
                whitelist.append('BasicRule wl:{} "mz:{}"'.format(nxdic[_id], nxdic[_var_name]))
101
            cpt += 1
102
    return render_template("misc/whitelist_generator.html", whitelist='\n'.join(whitelist) + ';', nxlogs=nxlogs)
103
104