Ignore:
Timestamp:
25 May 2009, 17:34:17 (15 years ago)
Author:
uli
Message:

Add datacenter method to retrieve imports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/datacenter.py

    r4166 r4170  
    8282        return result
    8383
     84    def getPossibleImports(self):
     85        """Get list of possible imports.
     86
     87        A single import is defined as a tuple
     88       
     89          ( <file-descr>, <importers> )
     90       
     91        where ``<file-descr>`` is an `IDataCenterFile` object and
     92        ``<importers>`` is a list of `IWAeUPCSVImporter` objects.
     93        """
     94        result = []
     95        importers = self.getImporters()
     96        for filedescr in self.getFiles():
     97            possible_importers = []
     98            for importer in importers:
     99                try:
     100                    # We could also try a complete parse...
     101                    importer.checkHeader(filedescr.context)
     102                except:
     103                    continue
     104                possible_importers.append(importer)
     105            if len(possible_importers) == 0:
     106                continue
     107            result.append((filedescr, possible_importers))
     108        return result
     109
    84110       
    85111class IDataCenterFile(Interface):
Note: See TracChangeset for help on using the changeset viewer.