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

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