Skip to content

Commit

Permalink
project: evaluate generator when performing operations
Browse files Browse the repository at this point in the history
The expected outcome here is to perform the operation on all of the
components while all(generator) would only run then until first fails.

The any(generator) branch works as expected as it is used for status
checking.

Fixes #11282
  • Loading branch information
nijel committed Mar 26, 2024
1 parent d186392 commit 63d0320
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Released on March 26th 2024.
* :ref:`mt-deepl` gracefully handles glossaries for language variants.
* :doc:`/formats/excel` better handles blank cells.
* Fixed possible data loss when merging gettext PO file changes in Git.
* Repository operations on project could have skipped some components.

**Upgrading**

Expand Down
4 changes: 3 additions & 1 deletion weblate/trans/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def on_repo_components(self, use_all: bool, func: str, *args, **kwargs):
for component in self.all_repo_components
)
if use_all:
return all(generator)
# Call methods on all components as this performs an operation
return all(list(generator))
# This is status checking, call only needed methods
return any(generator)

def commit_pending(self, reason, user):
Expand Down

0 comments on commit 63d0320

Please sign in to comment.