Here is my code:
toBe =[]
#Check if there is any get request
if request.GET.items() != []:
for x in DB:
try:
#This is removing the PMT that is spcific to the name
if request.GET['pmtName'] != "None":
if not request.GET['pmtName'] in x['tags']:
print x['title'], x['tags']
toBe.append(x)
continue
#This is removing the peak stuff
if int(request.GET['peakMin']):
if int(request.GET['peakMin']) < int(x['charge_peak']):
toBe.append(x)
continue
if int(request.GET['peakMax']):
if int(request.GET['peakMax']) > int(x['charge_peak']):
toBe.append(x)
continue
if int(request.GET['widthMin']):
if int(request.GET['widthMin']) < int(x['charge_width']):
toBe.append(x)
continue
if int(request.GET['widthMax']):
if int(request.GET['widthMax']) > int(x['charge_width']):
toBe.append(x)
continue
except:
pass
#TODO: Stupid hack, this needs to be fixed
for x in toBe:
DB.remove(x)
del toBe
Essentially I want to remove the item and then skip to the next one. The problem with this is that when that happens, it messes up the order of the list and skips some. Anyone know a work around for this? Or maybe just a different way of doing this?
thanks