def export_configured_areaobjects(self):
     wb_dbf = DBFExporter()
     dbf_configurations = DBFConfiguration.objects.filter(dbf_type="Area")
     logger.info("%s area's configurations to export." % len(
             dbf_configurations))
     for dbf_configuration in dbf_configurations:
         owner = dbf_configuration.data_set
         save_to = dbf_configuration.save_to
         filename = dbf_configuration.filename
         wb_dbf.export_aanafvoergebieden(owner, save_to, filename)
     logger.info("Export of 'aanafvoergebieden' is finished.")
예제 #2
0
def export_wbconfigurations_to_dbf(
    data_set=None,
    levelno=20,
    username=None,
    taskname=""):
    """
    Export water balance configurations into dbf.
    Use logging handler of lizard_task app. to write message into database.

    Arguments:
    data_set -- name of organisation as DataSet in lizard_security
    levelno -- logging level as number, 10=debug, 20=info, ...
    """
    logger = logging.getLogger(taskname)
    dbfexporter = DBFExporter(logger)
    dbf_configurations = DBFConfiguration.objects.exclude(dbf_type='Area')
    if data_set is not None:
        dbf_configurations = dbf_configurations.filter(data_set__name=data_set)
    for dbf_configuration in dbf_configurations:
        owner = dbf_configuration.data_set
        save_to = dbf_configuration.save_to
        filename = dbf_configuration.filename
        if dbf_configuration.dbf_type == 'AreaConfiguration':
            logger.info("Start export aanafvoergebieden for '%s'." % data_set)
            dbfexporter.export_areaconfiguration(owner, save_to, filename)
        elif dbf_configuration.dbf_type == 'Bucket':
            logger.info("Start export grondwatergebieden for '%s'." % data_set)
            dbfexporter.export_bucketconfiguration(owner, save_to, filename)
        elif dbf_configuration.dbf_type == 'Structure':
            logger.info("Start export grondwatergebieden for '%s'." % data_set)
            dbfexporter.export_structureconfiguration(owner, save_to, filename)
        else:
            logger.debug("UNKNOWN source %s" % dbf_configuration.dbf_type)
    logger.info("END EXPORT.")
예제 #3
0
def export_aanafvoergebieden_to_dbf(
    data_set=None,
    taskname='',
    levelno=20,
    username=None):
    """
    Export geo info of 'aanafvoergebieden' into dbf.
    """

    logger = logging.getLogger(taskname)
    dbfexporter = DBFExporter(logger)
    logger.info("Sart export of 'aanafvoergebieden'.")
    dbf_configurations = DBFConfiguration.objects.filter(dbf_type='Area')
    if data_set is not None:
        dbf_configurations = dbf_configurations.filter(data_set__name=data_set)
    for dbf_configuration in dbf_configurations:
        logger.info("Start export of 'aanafvoergebieden' for '%s'." % dbf_configuration.data_set.name)
        owner = dbf_configuration.data_set
        save_to = dbf_configuration.save_to
        filename = dbf_configuration.filename
        if dbf_configuration.dbf_type == 'Area':
            dbfexporter.export_aanafvoergebieden(owner, save_to, filename)
    logger.info("END EXPORT.")