Open harriebird opened 3 weeks ago
This (probably) happens because read-only views do not use transactions so they get mixed view (fetch component which is then removed together with translations). The removal itself happens in a transaction, so it is atomic.
There used to be ATOMIC_REQUESTS turned on, but it was later removed in 041a27c8abc86d6d1dbfe0358d965959d83631d6 as that caused several issues. Also, Django documentation mentions that it doesn't cover template rendering, and that's where we get this issue.
Possible approaches:
I tend to prefer the second approach, as that provides a better user experience, as the object scheduled for removal will disappear immediately from the UI, even if the removal might take long. On the other side, it will need more code changes, but we can initially focus only on the obvious code paths.
Hi @nijel, I have used the second approach as a guide in dealing with this issue. Please check my PR #12345.
Describe the issue
The IntegrityError occurs when adding an Android String Resource component from scratch and deleting it. The component and is deleted but it will lead to an error page same as shown below:
I already tried
Steps to reproduce the behavior
Create a new Project.
In the newly created project, add a new component. In the Create component page, select
Start from scratch
tab. Provide a Component name, and set its File format toAndroid String Resource
. ClickContinue
to proceed with the creation of the component.After a successful creation of the component, the Community localization checklist page is shown. Click
Return to the component
to go to the Component page. In the Component page, clickEnglish
in the list of languages.In the English project language page, you will be a adding new strings via upload since it is blank. To add the new strings, click the
Files
dropdown and selectUpload translation
. This will show the Upload form for the translation.Save the code below as XML file (.xml). This will be uploaded using the Upload form to add new strings.
In the Upload form, set the saved XML file as file to be uploaded. Set the File upload mode to
Add new strings
and clickUpload
to begin the adding of new strings.Once the adding of new strings is successful, go back to the Component page for its deletion. In the Component page, click the dropdown
Manage
and selectOrganize or remove
. Scroll to the bottom part of the page to see the Component removal form. In the Component removal form, provide the full slug of the component to confirm the deletion and clickI understand the consequences, delete this translation
button to proceed.After clicking the
I understand the consequences, delete this translation
button, theIntegrityError
page will be shown.Expected behavior
It is expected that it will redirect to the Project page and display a message
The translation component was scheduled for removal.
An example screenshot is shown below:Screenshots
No response
Exception traceback
How do you run Weblate?
Docker container
Weblate versions
Weblate deploy checks
Additional context
No response