def __call__(self): _type = self.request.form.get('type', 'layout') debug = self.request.form.get('debug') if debug: import pdb; pdb.set_trace() importer = getattr(self, 'import_' + _type) return importer() or "done"
def import_casestudy(self): from eea.climateadapt._importer import import_casestudy as importer from eea.climateadapt._importer import sql session = self._make_session() eea.climateadapt._importer.session = session site = self.context if 'casestudy' not in site.contentIds(): site.invokeFactory("Folder", 'casestudy') to_import = session.query(sql.AceMeasure) id = self.request.form.get('id') if id: to_import = to_import.filter_by(measureid=int(id)) for acemeasure in to_import: if acemeasure.mao_type == 'A': obj = importer(acemeasure, site['casestudy']) print "Imported ", obj.absolute_url()