Esempio n. 1
0
def listeTaxonCommune_pdf(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()
    listTaxons = vmTaxonsRepository.getListeTaxonsCommunes(connection, insee)
    #infosCommune = vmCommunesRepository.infosCommune(connection, insee)
    #epciCommune = vmCommunesRepository.epciCommune(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    #statsorgacomm = vmStatsOrgaCommRepository.getStatsOrgaCommChilds(connection, insee)
    #statsgroup2inpncomm = vmStatsGroup2inpnCommRepository.getStatsGroup2inpnCommChilds(connection, insee)
    #statstaxongroup2inpncomm = vmStatsTaxonGroup2inpnCommRepository.getStatsTaxonGroup2inpnCommChilds(connection, insee)
    #communesSearch = vmCommunesRepository.getAllCommunes(session)
    #epciSearch = vmEpciRepository.getAllEpci(session)
    #departementSearch = vmDepartementRepository.getAllDepartement(session)
    #if config.AFFICHAGE_MAILLE:
    #    observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
    #        connection, config.NB_LAST_OBS, insee
    #    )
    #else:
    #    observations = vmObservationsRepository.lastObservationsCommune(
    #        connection, config.NB_LAST_OBS, insee
    #    )
    #orgas = vmObservationsRepository.getOrgasCommunes(connection, insee)
    #observers = vmObservationsRepository.getObserversCommunes(connection, insee)

    configuration = base_configuration.copy()
    configuration.update({
      #  'NB_LAST_OBS': config.NB_LAST_OBS,
      #  'AFFICHAGE_ORGAS_OBS_FICHECOMM': config.AFFICHAGE_ORGAS_OBS_FICHECOMM,
      #  'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
      #  'MAP': config.MAP,
      #  'MYTYPE': 0,
      #  'PRESSION_PROSPECTION': config.PRESSION_PROSPECTION,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })
    session.close()
    connection.close()
    html = render_template(
        'static/custom/templates/listeTaxonCommune_pdf.html',
        insee=insee,
        now = (datetime.now()).strftime("%d-%m-%Y"),
        listTaxons=listTaxons,
        #infosCommune=infosCommune,
        #epciCommune=epciCommune,
        referenciel=commune,
        #statsorgacomm=statsorgacomm,
        #statsgroup2inpncomm=statsgroup2inpncomm,
        #statstaxongroup2inpncomm=statstaxongroup2inpncomm,
        #communesSearch=communesSearch,
        #epciSearch=epciSearch,
        #departementSearch=departementSearch,
        #observations=observations,
        #orgas=orgas,
        #observers=observers,
        configuration=configuration
    )    # Make a PDF straight from HTML in a string.
    return render_pdf(HTML(string=html))
Esempio n. 2
0
def ficheCommune(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()

    listTaxons = vmTaxonsRepository.getTaxonsCommunes(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
            connection, config.NB_LAST_OBS, insee
        )
    else:
        observations = vmObservationsRepository.lastObservationsCommune(
            connection, config.NB_LAST_OBS, insee
        )

    observers = vmObservationsRepository.getObserversCommunes(
        connection, insee
    )

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'MAP': config.MAP,
        'MYTYPE': 1,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template(
        'templates/ficheCommune.html',
        listTaxons=listTaxons,
        referenciel=commune,
        communesSearch=communesSearch,
        observations=observations,
        observers=observers,
        configuration=configuration
    )
Esempio n. 3
0
def ficheCommune(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()

    listTaxons = vmTaxonsRepository.getTaxonsCommunes(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
            connection, config.NB_LAST_OBS, insee)
    else:
        observations = vmObservationsRepository.lastObservationsCommune(
            connection, config.NB_LAST_OBS, insee)

    observers = vmObservationsRepository.getObserversCommunes(
        connection, insee)

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'MAP': config.MAP,
        'MYTYPE': 1,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template('templates/ficheCommune.html',
                           listTaxons=listTaxons,
                           referenciel=commune,
                           communesSearch=communesSearch,
                           observations=observations,
                           observers=observers,
                           configuration=configuration)
Esempio n. 4
0
def ficheCommune(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()

    listTaxons = vmTaxonsRepository.getTaxonsCommunes(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
            connection, config.NB_LAST_OBS, insee)
    else:
        observations = vmObservationsRepository.lastObservationsCommune(
            connection, config.NB_LAST_OBS, insee)

    observers = vmObservationsRepository.getObserversCommunes(
        connection, insee)
    configuration = {'STRUCTURE' : config.STRUCTURE, 'NOM_APPLICATION' : config.NOM_APPLICATION, 'NB_LAST_OBS': config.NB_LAST_OBS, 'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE, 'MAP': config.MAP, \
    'URL_APPLICATION': config.URL_APPLICATION, 'MYTYPE' : 1, 'PATRIMONIALITE': config.PATRIMONIALITE, 'PROTECTION': config.PROTECTION, 'AFFICHAGE_FOOTER': config.AFFICHAGE_FOOTER, 'ID_GOOGLE_ANALYTICS': config.ID_GOOGLE_ANALYTICS}

    session.close()
    connection.close()

    return render_template('templates/ficheCommune.html', listTaxons = listTaxons, referenciel = commune, communesSearch = communesSearch, observations = observations, \
    observers=observers, configuration = configuration)
Esempio n. 5
0
def ficheCommune(insee):
    session = utils.loadSession()
    connection = utils.engine.connect()
    listTaxons = vmTaxonsRepository.getTaxonsCommunes(connection, insee)
    listespeces = vmTaxonsRepository.getListeTaxonsCommunes(connection, insee)
    taxonProPatri = vmStatsStatutTaxonCommRepository.getNbTaxonsProPatriCommunes(connection, insee)
    statsStatutTaxonComm = vmStatsStatutTaxonCommRepository.getStatsStatutsTaxonsCommunes(connection, insee)
    infosCommune = vmCommunesRepository.infosCommune(connection, insee)
    epciCommune = vmCommunesRepository.epciCommune(connection, insee)
    commune = vmCommunesRepository.getCommuneFromInsee(connection, insee)
    statsorgataxoncomm = vmStatsOrgaCommRepository.getStatsOrgaTaxonCommChilds(connection, insee)
    statsorgadatacomm = vmStatsOrgaCommRepository.getStatsOrgaDataCommChilds(connection, insee)
    statsgroup2inpncomm = vmStatsGroup2inpnCommRepository.getStatsGroup2inpnCommChilds(connection, insee)
    statstaxongroup2inpncomm = vmStatsTaxonGroup2inpnCommRepository.getStatsTaxonGroup2inpnCommChilds(connection, insee)
    communesSearch = vmCommunesRepository.getAllCommunes(session)
    epciSearch = vmEpciRepository.getAllEpci(session)
    departementSearch = vmDepartementRepository.getAllDepartement(session)
    if config.AFFICHAGE_MAILLE:
        observations = vmObservationsMaillesRepository.lastObservationsCommuneMaille(
            connection, config.NB_LAST_OBS, insee
        )
    else:
        observations = vmObservationsRepository.lastObservationsCommune(
            connection, config.NB_LAST_OBS, insee
        )
    orgas = vmObservationsRepository.getOrgasCommunes(connection, insee)
    observers = vmObservationsRepository.getObserversCommunes(connection, insee)

    configuration = base_configuration.copy()
    configuration.update({
        'NB_LAST_OBS': config.NB_LAST_OBS,
        'AFFICHAGE_ORGAS_OBS_FICHECOMM': config.AFFICHAGE_ORGAS_OBS_FICHECOMM,
        'AFFICHAGE_MAILLE': config.AFFICHAGE_MAILLE,
        'MAP': config.MAP,
        'MYTYPE': 0,
        'PRESSION_PROSPECTION': config.PRESSION_PROSPECTION,
        'AFFICHE_PATRIMONIALITE' : config.AFFICHE_PATRIMONIALITE,
        'PATRIMONIALITE': config.PATRIMONIALITE,
        'PROTECTION': config.PROTECTION
    })

    session.close()
    connection.close()

    return render_template(
        'templates/ficheCommune.html',
        insee=insee,
        listTaxons=listTaxons,
        listespeces=listespeces,
        taxonProPatri=taxonProPatri,
        statsStatutTaxonComm=statsStatutTaxonComm,
        infosCommune=infosCommune,
        epciCommune=epciCommune,
        referenciel=commune,
        statsorgataxoncomm=statsorgataxoncomm,
        statsorgadatacomm=statsorgadatacomm,
        statsgroup2inpncomm=statsgroup2inpncomm,
        statstaxongroup2inpncomm=statstaxongroup2inpncomm,
        communesSearch=communesSearch,
        epciSearch=epciSearch,
        departementSearch=departementSearch,
        observations=observations,
        orgas=orgas,
        observers=observers,
        configuration=configuration
    )