Changeset 1282
- Timestamp:
- 11/03/06 16:25:43 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/Release2.1.1b/monitor/cgi-bin/filelist.py
r739 r1282 1 1 #!/usr/bin/python 2 2 import os 3 import sre 3 4 from obsconfig import observatory 4 5 5 6 class FileList: 6 7 7 def __init__(self, loc=None ):8 def __init__(self, loc=None, projectcode=None): 8 9 self.message ="""Content-Type: text/xml 9 10 10 11 <?xml version="1.0" encoding="ISO-8859-1"?>""" 11 12 12 self.error = None 13 13 if loc is None: … … 21 21 loc = observatory['rpfpath'][loc] 22 22 if os.path.exists(loc) and os.path.isdir(loc): 23 self.files = filter(lambda x: x.lower().endswith("rpf"), os.listdir(loc)) 23 rx = sre.compile("\d{4}-\d{2}-d{2}_\d{4}-M\d{3}.rpf.*") 24 self.files = [ f for f in os.listdir(loc) if sre.match(rx, f) ] 25 if projectcode is not None: 26 self.files = [ f for f in self.files if sre.match(projectcode, 27 f) ] 24 28 if len(self.files) == 0: 25 29 self.error = "No rpfits files found" … … 42 46 import cgi 43 47 form = cgi.FieldStorage() 48 pfilter = None 49 if form.has_key('project'): 50 pfilter = form.getfirst("project", None) 44 51 if form.has_key('path'): 45 52 pathindex = form.getfirst("path",0) 46 print FileList(pathindex )53 print FileList(pathindex, pfilter) 47 54 else: 48 55 print FileList()
Note:
See TracChangeset
for help on using the changeset viewer.