don't filter certs based on the file's extension
[sfa.git] / sfa / trust / trustedroot.py
1 import os.path
2 import glob
3
4 from sfa.trust.gid import GID
5
6 class TrustedRootList:
7     def __init__(self, dir):
8         self.basedir = dir
9         # create the directory to hold the files, if not existing
10         if not os.path.isdir (self.basedir):
11             os.makedirs(self.basedir)
12
13     def add_gid(self, gid):
14         fn = os.path.join(self.basedir, gid.get_hrn() + ".gid")
15         gid.save_to_file(fn)
16
17     def get_list(self):
18         gid_list = [GID(filename=cert_file) for cert_file in self.get_file_list()]
19         return gid_list
20
21     def get_file_list(self):
22         file_list  = []
23         for cert_file in os.listdir(self.basedir):
24             if os.path.isfile(cert_file):
25                 file_list.append(os.path.join(self.basedir, cert_file)) 
26         return file_list