def disable_if_missing(self): """Disable the current translation project if its directory doesn't exist. :return: True if the current translation_project (i.e. self) has been disabled. """ if not self.disabled and does_not_exist(self.abs_real_path): logging.info(u"Disabling %s", self) self.disabled = True self.save() self.update_parent_cache(exclude_self=True) return True return False
def disable_if_missing(self): """Disable the current translation project if its directory doesn't exist. :return: True if the current translation_project (i.e. self) has been disabled. """ if not self.disabled and does_not_exist(self.abs_real_path): logging.info(u"Disabling %s", self) self.disabled = True self.save() self.update_parent_cache() return True return False
def scan_translation_projects(languages=None, projects=None): project_query = Project.objects.all() if projects is not None: project_query = project_query.filter(code__in=projects) for project in project_query.iterator(): if does_not_exist(project.get_real_path()): logging.info(u"Disabling %s", project) project.disabled = True project.save() else: lang_query = Language.objects.exclude( id__in=project.translationproject_set.live().values_list('language', flat=True)) if languages is not None: lang_query = lang_query.filter(code__in=languages) for language in lang_query.iterator(): create_or_resurrect_translation_project(language, project)
def scan_translation_projects(languages=None, projects=None): project_query = Project.objects.all() if projects is not None: project_query = project_query.filter(code__in=projects) for project in project_query.iterator(): if does_not_exist(project.get_real_path()): logging.info(u"Disabling %s", project) project.disabled = True project.save() else: lang_query = Language.objects.exclude( id__in=project.translationproject_set.live().values_list( 'language', flat=True)) if languages is not None: lang_query = lang_query.filter(code__in=languages) for language in lang_query.iterator(): create_or_resurrect_translation_project(language, project)
def directory_exists(self): """Checks if the actual directory for the translation project exists on-disk. """ return not does_not_exist(self.abs_real_path)