Beispiel #1
0
    def import_aceitems(self):
        from eea.climateadapt._importer import import_aceitem
        from eea.climateadapt._importer import sql

        session = self._make_session()
        eea.climateadapt._importer.session = session
        site = self.context

        if 'content' not in site.contentIds():
            site.invokeFactory("Folder", 'content')

        for aceitem in session.query(sql.AceAceitem):
            if aceitem.datatype in ['ACTION', 'MEASURE']:
                # TODO: log and solve here
                continue
            import_aceitem(aceitem, site['content'])
    def import_aceitems(self):
        from eea.climateadapt._importer import import_aceitem
        from eea.climateadapt._importer import sql

        session = self._make_session()
        eea.climateadapt._importer.session = session
        site = self.context

        if 'content' not in site.contentIds():
            site.invokeFactory("Folder", 'content')

        for aceitem in session.query(sql.AceAceitem):
            if aceitem.datatype in ['ACTION', 'MEASURE']:
                # TODO: log and solve here
                continue
            import_aceitem(aceitem, site['content'])
Beispiel #3
0
    def import_aceitems(self):
        from eea.climateadapt._importer import import_aceitem
        from eea.climateadapt._importer import sql
        from eea.climateadapt._importer.tweak_sql import fix_relations

        session = self._make_session()
        eea.climateadapt._importer.session = session
        fix_relations(session)
        site = self.context

        id = self.request.form.get('id')
        if id:
            aceitem = session.query(sql.AceAceitem).\
                filter_by(aceitemid=int(id)).one()
            obj = import_aceitem(aceitem, site)
            return self.request.response.redirect(obj.absolute_url())

        base_import_aceitems(session, site)
        return 'done'