Пример #1
0
 def save(self, *args, **kwargs):
     created = self.id is None
     project_dir = self.project.get_real_path()
     self.abs_real_path = project_tree.get_translation_project_dir(self.language, project_dir, self.file_style, make_dirs=True)
     self.directory = self.language.directory.get_or_make_subdir(self.project.code)
     self.pootle_path = self.directory.pootle_path
     super(TranslationProject, self).save(*args, **kwargs)
     if created:
         self.scan_files()
Пример #2
0
    def save(self, *args, **kwargs):
        self.directory = self.language.directory.get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        self.abs_real_path = get_translation_project_dir(
            self.language,
            self.project.get_real_path(),
            make_dirs=not self.directory.obsolete,
        )
        super().save(*args, **kwargs)
Пример #3
0
 def save(self, *args, **kwargs):
     created = self.id is None
     project_dir = self.project.get_real_path()
     self.abs_real_path = project_tree.get_translation_project_dir(
         self.language, project_dir, self.file_style, make_dirs=True)
     self.directory = self.language.directory.get_or_make_subdir(
         self.project.code)
     self.pootle_path = self.directory.pootle_path
     super(TranslationProject, self).save(*args, **kwargs)
     if created:
         self.scan_files()
Пример #4
0
    def save(self, *args, **kwargs):
        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(
            self.language, project_dir, self.file_style, make_dirs=not
            self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)
Пример #5
0
    def save(self, *args, **kwargs):
        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(
            self.language, project_dir, self.file_style, make_dirs=not
            self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)
Пример #6
0
    def save(self, *args, **kwargs):
        created = self.id is None

        if created:
            from pootle_app.project_tree import translation_project_dir_exists

            template_tp = self.project.get_template_translationproject()
            initialize_from_templates = (
                not self.is_template_project
                and template_tp is not None
                and not translation_project_dir_exists(self.language,
                                                       self.project))

        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(
            self.language, project_dir, self.file_style, make_dirs=not
            self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            if initialize_from_templates:
                # We are adding a new TP and there are no files to import from
                # disk, so initialize the TP files using the templates TP ones.
                from pootle_app.project_tree import init_store_from_template

                template_stores = template_tp.stores.live().exclude(file="")

                for template_store in template_stores.iterator():
                    init_store_from_template(self, template_store)

            self.scan_files()

            # If this TP has no stores, cache should be updated forcibly.
            if self.stores.live().count() == 0:
                self.update_all_cache()

            # Create units from disk store
            for store in self.stores.live().iterator():
                changed = store.update_from_disk()

                # If there were changes stats will be refreshed anyway -
                # otherwise...  Trigger stats refresh for TP added from UI.
                # FIXME: This won't be necessary once #3547 is fixed.
                if not changed:
                    store.save(update_cache=True)
Пример #7
0
    def save(self, *args, **kwargs):
        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        if self.project.treestyle != 'pootle_fs':
            from pootle_app.project_tree import get_translation_project_dir
            self.abs_real_path = get_translation_project_dir(
                self.language, self.project, self.file_style, make_dirs=not
                self.directory.obsolete)
        else:
            self.abs_real_path = None
        super(TranslationProject, self).save(*args, **kwargs)
        if self.directory.tp_id != self.pk:
            self.directory.tp = self
            self.directory.save()
Пример #8
0
    def save(self, *args, **kwargs):
        created = self.id is None

        if created:
            from pootle_app.project_tree import translation_project_dir_exists

            template_tp = self.project.get_template_translationproject()
            initialize_from_templates = (not self.is_template_project
                                         and template_tp is not None and
                                         not translation_project_dir_exists(
                                             self.language, self.project))

        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(
            self.language,
            project_dir,
            self.file_style,
            make_dirs=not self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            if initialize_from_templates:
                # We are adding a new TP and there are no files to import from
                # disk, so initialize the TP files using the templates TP ones.
                from pootle_app.project_tree import init_store_from_template

                for template_store in template_tp.stores.live().iterator():
                    init_store_from_template(self, template_store)

            self.scan_files()

            # Create units from disk store
            for store in self.stores.live().iterator():
                changed = store.update_from_disk()

                # If there were changes stats will be refreshed anyway - otherwise...
                # Trigger stats refresh for TP added from UI.
                # FIXME: This won't be necessary once #3547 is fixed.
                if not changed:
                    store.save(update_cache=True)
Пример #9
0
    def save(self, *args, **kwargs):
        created = self.id is None

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(self.language,
                project_dir, self.file_style, make_dirs=True)
        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        # Apply markup filter
        self.description_html = apply_markup_filter(self.description)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            self.scan_files()
Пример #10
0
    def save(self, *args, **kwargs):
        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        if self.project.treestyle != 'pootle_fs':
            from pootle_app.project_tree import get_translation_project_dir
            self.abs_real_path = get_translation_project_dir(
                self.language,
                self.project,
                self.file_style,
                make_dirs=not self.directory.obsolete)
        else:
            self.abs_real_path = None
        super(TranslationProject, self).save(*args, **kwargs)
        if self.directory.tp_id != self.pk:
            self.directory.tp = self
            self.directory.save()
Пример #11
0
    def save(self, *args, **kwargs):
        created = self.id is None

        if created:
            from pootle_app.project_tree import translation_project_should_exist

            template_tp = self.project.get_template_translationproject()
            initialize_from_templates = False

            if (not self.is_template_project and
                template_tp is not None and
                not translation_project_should_exist(self.language,
                                                     self.project)):

                initialize_from_templates = True

        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(self.language,
             project_dir, self.file_style,
             make_dirs=not self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            if initialize_from_templates:
                # We are adding a new TP and there are no files to import from
                # disk, so initialize the TP files using the templates TP ones.
                from pootle_app.project_tree import init_store_from_template

                for template_store in template_tp.stores.iterator():
                    init_store_from_template(self, template_store)

            self.scan_files()

            if initialize_from_templates:
                # Trigger stats refresh for TP added from UI.
                # FIXME: This won't be necessary once #3547 is fixed.
                for store in self.stores.live().iterator():
                    store.update()
Пример #12
0
    def save(self, *args, **kwargs):
        created = self.id is None

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(self.language,
                                                         project_dir,
                                                         self.file_style,
                                                         make_dirs=True)
        self.directory = self.language.directory.get_or_make_subdir(
            self.project.code)
        self.pootle_path = self.directory.pootle_path

        # Apply markup filter
        self.description_html = apply_markup_filter(self.description)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            self.scan_files()
Пример #13
0
    def save(self, *args, **kwargs):
        created = self.id is None

        if created:
            from pootle_app.project_tree import translation_project_dir_exists

            template_tp = self.project.get_template_translationproject()
            initialize_from_templates = (
                not self.is_template_project
                and template_tp is not None
                and not translation_project_dir_exists(self.language,
                                                       self.project))

        self.directory = self.language.directory \
                                      .get_or_make_subdir(self.project.code)
        self.pootle_path = self.directory.pootle_path

        project_dir = self.project.get_real_path()
        from pootle_app.project_tree import get_translation_project_dir
        self.abs_real_path = get_translation_project_dir(
            self.language, project_dir, self.file_style, make_dirs=not
            self.directory.obsolete)

        super(TranslationProject, self).save(*args, **kwargs)

        if created:
            if initialize_from_templates:
                # We are adding a new TP and there are no files to import from
                # disk, so initialize the TP files using the templates TP ones.
                from pootle_app.project_tree import init_store_from_template

                template_stores = template_tp.stores.live().exclude(file="")

                for template_store in template_stores.iterator():
                    init_store_from_template(self, template_store)

                self.update_from_disk()