def write_source_info(self, info): """Writes the source info into the database. The source info is an instance of :class:`lektor.build_programs.SourceInfo`. """ reporter.report_write_source_info(info) source = self.to_source_filename(info.filename) con = self.connect_to_database() try: cur = con.cursor() for lang, title in iteritems(info.title_i18n): cur.execute(''' insert or replace into source_info (path, alt, lang, type, source, title) values (?, ?, ?, ?, ?, ?) ''', [info.path, info.alt, lang, info.type, source, title]) con.commit() finally: con.close()