from datetime import datetime, timedelta
try:
import json
-except ImportError, e:
+except ImportError as e:
import simplejson as json
import os
"""
try:
fc = FlowCell.objects.get(flowcell_id__startswith=flowcell_id)
- except FlowCell.DoesNotExist, e:
+ except FlowCell.DoesNotExist as e:
return None
lane_set = {}
'library_name': lane.library.library_name,
'library_id': lane.library.id,
'library_species': lane.library.library_species.scientific_name,
- 'pM': unicode(lane.pM),
+ 'pM': str(lane.pM),
'read_length': lane.flowcell.read_length,
'status_code': lane.status,
'status': LANE_STATUS_MAP[lane.status]
try:
result = lanes_for(username)
- except ObjectDoesNotExist, e:
+ except ObjectDoesNotExist as e:
raise Http404
#convert query set to python structure
user = request.user
#Check access permission
- if not (user.is_superuser and settings.ALLOWED_IPS.has_key(ClIP)):
+ if not (user.is_superuser and ClIP in settings.ALLOWED_IPS):
return HttpResponse("%s access denied from %s." % (user, ClIP))
# ~~~~~~Parameters for the job ~~~~
- if request.REQUEST.has_key('fcid'):
+ if 'fcid' in request.REQUEST:
fcid = request.REQUEST['fcid']
else:
return HttpResponse('missing fcid')
- if request.REQUEST.has_key('runf'):
+ if 'runf' in request.REQUEST:
runfolder = request.REQUEST['runf']
else:
return HttpResponse('missing runf')
- if request.REQUEST.has_key('updst'):
+ if 'updst' in request.REQUEST:
UpdatedStatus = request.REQUEST['updst']
else:
return HttpResponse('missing status')
#if there's a message update that too
mytimestamp = datetime.now().__str__()
mytimestamp = re.sub(pattern=":[^:]*$",repl="",string=mytimestamp)
- if request.REQUEST.has_key('msg'):
+ if 'msg' in request.REQUEST:
rec.run_note += ", "+request.REQUEST['msg']+" ("+mytimestamp+")"
else :
if UpdatedStatus == '1':
def getConfile(req):
granted = False
ClIP = req.META['REMOTE_ADDR']
- if (settings.ALLOWED_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_IPS): granted = True
if not granted: return HttpResponse("access denied. IP: "+ClIP)
cnfgfile = 'Nothing found'
runfolder = 'unknown'
request = req.REQUEST
- if request.has_key('fcid'):
+ if 'fcid' in request:
fcid = request['fcid']
- if request.has_key('runf'):
+ if 'runf' in request:
runfolder = request['runf']
try:
rec = DataRun.objects.get(run_folder=runfolder) #,flowcell_id=fcid)
def getLaneLibs(req):
granted = False
ClIP = req.META['REMOTE_ADDR']
- if (settings.ALLOWED_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_IPS): granted = True
if not granted: return HttpResponse("access denied.")
request = req.REQUEST
fcid = 'none'
outputfile = ''
- if request.has_key('fcid'):
+ if 'fcid' in request:
fcid = request['fcid']
try:
rec = FlowCell.objects.get(flowcell_id=fcid)