def get_factories(case, scanners): """ Scanner factories are obtained from the Store or created as required. Scanners is a list in the form case:scanner """ ## Ensure dependencies are satisfied scanners = ScannerUtils.fill_in_dependancies(scanners) ## First prepare the required factories: result = [] for scanner in scanners: key = DB.expand("%s:%s", (case, scanner)) try: f = factories.get(key) except KeyError: try: cls = Registry.SCANNERS.dispatch(scanner) except: # pyflaglog.log(pyflaglog.WARNING, "Unable to find scanner for %s", scanner) continue # Instatiate it: import pyflag.FileSystem as FileSystem f = cls(FileSystem.DBFS(case)) ## Initialise it: f.prepare() ## Store it: factories.put(f, key=key) result.append(f) return result
def get_factories(scanners): """ Scanner factories are obtained from the Store or created as required. """ ## Ensure dependencies are satisfied scanners = ScannerUtils.fill_in_dependancies(scanners) ## First prepare the required factories: result = [] for scanner in scanners: try: f=factories.get(scanner) except KeyError: try: cls=Registry.SCANNERS.dispatch(scanner) except: #pyflaglog.log(pyflaglog.WARNING, "Unable to find scanner for %s", scanner) continue #Instatiate it: f=cls() ## Store it: factories.put(f,key=scanner) result.append(f) return result
def get_factories(scanners): """ Scanner factories are obtained from the Store or created as required. """ ## Ensure dependencies are satisfied scanners = ScannerUtils.fill_in_dependancies(scanners) ## First prepare the required factories: result = [] for scanner in scanners: try: f = factories.get(scanner) except KeyError: try: cls = Registry.SCANNERS.dispatch(scanner) except: #pyflaglog.log(pyflaglog.WARNING, "Unable to find scanner for %s", scanner) continue #Instatiate it: f = cls() ## Store it: factories.put(f, key=scanner) result.append(f) return result
left.row(right,self.description) result.const_selector(left, scan_group_name, ['on','off'],['Enabled','Disabled']) ## This is a global store for factories: import pyflag.Store as Store factories = Store.Store() def get_factories(case,scanners): """ Scanner factories are obtained from the Store or created as required. Scanners is a list in the form case:scanner """ ## Ensure dependencies are satisfied scanners = ScannerUtils.fill_in_dependancies(scanners) ## First prepare the required factories: result = [] for scanner in scanners: key = DB.expand("%s:%s", (case,scanner)) try: f=factories.get(key) except KeyError: try: cls=Registry.SCANNERS.dispatch(scanner) except: #pyflaglog.log(pyflaglog.WARNING, "Unable to find scanner for %s", scanner) continue #Instatiate it: