Update some of Rami's GERALD config file generator to Django 1.0 API
authorDiane Trout <diane@caltech.edu>
Fri, 27 Feb 2009 22:04:32 +0000 (22:04 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 27 Feb 2009 22:04:32 +0000 (22:04 +0000)
and get the config file to show up in a browser by setting the mime/type

htsworkflow/frontend/experiments/experiments.py

index d11cda75a22d6652e4f35ec4363772eeea7db66d..ca224a95753fe1f9723dd8bbf45a5d81e5c5ab0e 100755 (executable)
@@ -120,16 +120,20 @@ def generateConfile(request,fcid):
 
     return cnfgfile
 
-def getConfile(request):
+def getConfile(req):
     granted = False
-    ClIP = request.META['REMOTE_ADDR']
+    ClIP = req.META['REMOTE_ADDR']
     if (settings.ALLOWED_IPS.has_key(ClIP)):  granted = True
 
     if not granted: return HttpResponse("access denied. IP: "+ClIP)
 
     fcid = 'none'
-    cnfgfile = ''
+    cnfgfile = 'Nothing found'
     runfolder = 'unknown'
+    request = req.REQUEST
+    print request, dir(request)
+    print request['fcid'], request.has_key('fcid')
+    print request['runf']
     if request.has_key('fcid'):
       fcid = request['fcid']
       if request.has_key('runf'):
@@ -151,19 +155,20 @@ def getConfile(request):
         except ObjectDoesNotExist:
           cnfgfile = 'Entry not found for RunFolder = '+runfolder
 
-    return HttpResponse(cnfgfile)
+    return HttpResponse(cnfgfile, mimetype='text/plain')
 
-def getLaneLibs(request):
+def getLaneLibs(req):
     granted = False
-    ClIP = request.META['REMOTE_ADDR']
+    ClIP = req.META['REMOTE_ADDR']
     if (settings.ALLOWED_IPS.has_key(ClIP)):  granted = True
 
     if not granted: return HttpResponse("access denied.")
 
+    request = req.REQUEST
     fcid = 'none'
     outputfile = ''
     if request.has_key('fcid'):
-      fcid = request['fcid']                                                                                                      
+      fcid = request['fcid']
       try:                                
         rec = FlowCell.objects.get(flowcell_id=fcid)
         #Ex: 071211
@@ -191,4 +196,4 @@ def getLaneLibs(request):
         outputfile = 'Flowcell entry not found for: '+fcid
     else: outputfile = 'Missing input: flowcell id'
 
-    return HttpResponse(outputfile)
+    return HttpResponse(outputfile, mimetype='text/plain')