def get(self, name): c = self.connection.cursor() command = u"SELECT * FROM projects WHERE name='{0}'".format(name) result = c.execute(command) row = result.fetchone() if row is None: return None dto = ProjectMetaDataDto(row[0]) dto.last_fetch = row[1] dto.last_translation_update = row[2] dto.words = row[3] dto.checksum = row[4] return dto
def get(self, name): c = self.connection.cursor() command = u"SELECT * FROM projects WHERE name='{0}'".format(name) result = c.execute(command) row = result.fetchone() if row is None: return None dto = ProjectMetaDataDto(row[0]) dto.last_fetch = row[1] dto.last_translation_update = row[2] dto.words = row[3] dto.checksum = row[4] return dto
def __call__(self): """Process all projects""" for project in self.projects: project.do() words, entries = project.get_words_entries() if words == -1: continue metadata_dto = self.metadata_dao.get(project.name) if metadata_dto is None: metadata_dto = ProjectMetaDataDto(project.name) if (metadata_dto.checksum is None or metadata_dto.checksum != project.checksum): metadata_dto.last_translation_update = datetime.datetime.now() metadata_dto.checksum = project.checksum metadata_dto.last_fetch = datetime.datetime.now() metadata_dto.words = words self.metadata_dao.put(metadata_dto) self.create_tm_for_all_projects()
def __call__(self): """Process all projects""" for project in self.projects: project.do() words, entries = project.get_words_entries() if words == -1: continue metadata_dto = self.metadata_dao.get(project.name) if metadata_dto is None: metadata_dto = ProjectMetaDataDto(project.name) if (metadata_dto.checksum is None or metadata_dto.checksum != project.checksum): metadata_dto.last_translation_update = datetime.datetime.now() metadata_dto.checksum = project.checksum metadata_dto.last_fetch = datetime.datetime.now() metadata_dto.words = words self.metadata_dao.put(metadata_dto) self.create_tm_for_all_projects()