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 = timezone.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 generateConfile(request,fcid):
#granted = False
#ClIP = request.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.")
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)
def require_api_key(request):
# make sure we have the api component
- if not (request.REQUEST.has_key('apiid') or request.REQUEST.has_key('apikey')):
+ if not ('apiid' in request.REQUEST or 'apikey' in request.REQUEST):
raise PermissionDenied
# make sure the id and key are right
# if we've already seen an event in this directory (AKA runfolder)
# keep track if its already hit the "completed" flag
- if watch_path_events.has_key(target):
+ if target in watch_path_events:
run_already_complete = watch_path_events[target].complete
watch_path_events[target] = WatcherEvent(target)
ClIP = request.META['REMOTE_ADDR']
#Check client access permission
granted = False
- if (settings.ALLOWED_ANALYS_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_ANALYS_IPS): granted = True
if not granted: return HttpResponse("access denied.")
output=''
taskid=-1;
# Check required param
- if request.has_key('taskid'): taskid = request['taskid']
+ if 'taskid' in request: taskid = request['taskid']
else: return HttpResponse('missing param task id')
try:
rec = Task.objects.get(id=taskid)
mytimestamp = datetime.now().__str__()
mytimestamp = re.sub(pattern=":[^:]*$",repl="",string=mytimestamp)
- if request.has_key('msg'):
+ if 'msg' in request:
rec.task_status += ", "+request['msg']+" ("+mytimestamp+")"
else :
rec.task_status = "Registered ("+mytimestamp+")"
ClIP = request.META['REMOTE_ADDR']
#Check client access permission
granted = False
- if (settings.ALLOWED_ANALYS_IPS.has_key(ClIP)): granted = True
+ if (ClIP in settings.ALLOWED_ANALYS_IPS): granted = True
if not granted: return HttpResponse("access denied.")
outputfile = ''
All=False
- if (request.has_key('mode')):
+ if ('mode' in request):
if request['mode']=='all':
All=True
def report1(request):
EXP = 'ChIP-seq'
- if request.GET.has_key('aflid'):
+ if 'aflid' in request.GET:
AFL_Id = request.GET['aflid']
try:
AFL = Affiliation.objects.get(id=AFL_Id).name
def report_RM(request): #for RNA-Seq and Methyl-Seq
EXP = 'RNA-seq'
- if request.GET.has_key('exp'):
+ if 'exp' in request.GET:
EXP = request.GET['exp'] # Methyl-seq
- if request.GET.has_key('aflid'):
+ if 'aflid' in request.GET:
AFL_Id = request.GET['aflid']
try:
AFL = Affiliation.objects.get(id=AFL_Id).name
# add phasing parameters
for lane in LANE_LIST:
- if self.phasing.has_key(lane):
+ if lane in self.phasing:
params.append(self.phasing[lane].get_elements())
# add crosstalk matrix if it exists
tree = ElementTree.parse(paramfile).getroot()
run = tree.find('Run')
- if run.attrib.has_key('Name') and run.attrib['Name'] in SOFTWARE_NAMES:
+ if run.attrib.get('Name', None) in SOFTWARE_NAMES:
return run
else:
LOGGER.info("No run found")
('Lane Results Summary : Read 1', 0),
('Lane Results Summary : Read 2', 1),]
for name, end in table_names:
- if tables.has_key(name):
+ if name in tables:
self._extract_lane_results_for_end(tables, name, end)
if len(self.lane_results[0]) == 0:
lane_library = [ (x[0][5], x[1]) for x in fc.items()
if library_id_re.match(x[0]) ]
for lane, library_id in lane_library:
- if not self.library[library_id].has_key('lanes'):
+ if 'lanes' not in self.library[library_id]:
self.library[library_id]['lanes'] = []
self.library[library_id]['lanes'].append((fc_id, lane))
flowcell_info = None
# get info about flowcell from server or shelf
- if not fcdb.has_key(flowcell):
+ if flowcell not in fcdb:
url = api.flowcell_url(baseurl, flowcell)
flowcell_info = api.retrieve_info(url, apidata)
if flowcell_info is not None: