Example #1
0
def export_esf_to_dbf(
    data_set=None,
    levelno=20,
    username=None,
    taskname=""):
    """
    Export esf configurations into dbf.
    """
    logger = logging.getLogger(taskname)
    dbfexporter = DBFExporter(logger)
    dbf_configurations = DBFConfiguration.objects.filter(enabled=True)
    if data_set is not None:
        dbf_configurations = dbf_configurations.filter(data_set__name=data_set)
    logger.info("%s esf configurations to export." % len(
            dbf_configurations))
    for dbf_configuration in dbf_configurations:
        owner = dbf_configuration.data_set
        save_to = dbf_configuration.save_to
        dbf_file = dbf_configuration.dbf_file
        filename = dbf_configuration.filename
        logger.info("Start export '%s' for '%s'." % (dbf_file, owner))
        dbfexporter.export_esf_configurations(
            owner, save_to, dbf_file, filename)
        logger.info("End export '%s' for '%s'." % (dbf_file, owner))
    logger.info("END EXPORT.")
Example #2
0
 def export(self):
     dbf_configurations = DBFConfiguration.objects.filter(enabled=True)
     dbfexporter = DBFExporter()
     logger.info("%s esf configurations to export." % len(
             dbf_configurations))
     for dbf_configuration in dbf_configurations:
         owner = dbf_configuration.data_set
         save_to = dbf_configuration.save_to
         dbf_file = dbf_configuration.dbf_file
         filename = dbf_configuration.filename
         dbfexporter.export_esf_configurations(
             owner, save_to, dbf_file, filename)
     logger.info("Export of esf configurations is finished.")