示例#1
0
    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
示例#2
0
文件: models.py 项目: shackra/pootle
    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
示例#3
0
文件: models.py 项目: ta2-1/pootle
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)
示例#4
0
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)
示例#5
0
文件: models.py 项目: Jobava/pootle
 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)
示例#6
0
 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)