WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.52k stars 1k forks source link

Internal Server Error on manage/addons/ with git exporter enabled #11976

Closed mkstephenson closed 3 months ago

mkstephenson commented 3 months ago

Describe the issue

When I have the "git.exporter" addon enabled and I navigate to the addons management page in the UI, I get an internal server error. The error in the console tells me that "module 'weblate.gitexport' has no attribute 'get_identifier'".

I already tried

Steps to reproduce the behavior

  1. Start weblate 4.6.1 in docker with WEBLATE_ADD_ADDONS=weblate.gitexport as an environment variable.
  2. Log in and go to the addons management page (🔧 => Add-ons) and see the "Server Error" page.
  3. View the docker logs and see the exception in the console logs

Expected behavior

I expect to see the list of addons, git exporter addon being shown here is optional but would be nice.

Screenshots

No response

Exception traceback

Traceback (most recent call last):
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/core/handlers/excepti=
gunicorn stdout | on.py", line 55, in inner
gunicorn stdout |     response =3D get_response(request)
gunicorn stdout |                ^^^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/core/handlers/base.py=
gunicorn stdout | ", line 197, in _get_response
gunicorn stdout |     response =3D wrapped_callback(request, *callback_args, **callback_kwarg=
gunicorn stdout | s)
gunicorn stdout |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/views/generic/base.py=
gunicorn stdout | ", line 104, in view
gunicorn stdout |     return self.dispatch(request, *args, **kwargs)
gunicorn stdout |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/views/generic/base.py=
gunicorn stdout | ", line 143, in dispatch
gunicorn stdout |     return handler(request, *args, **kwargs)
gunicorn stdout |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/views/generic/list.py=
gunicorn stdout | ", line 174, in get
gunicorn stdout |     context =3D self.get_context_data()
gunicorn stdout |               ^^^^^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/weblate/addons/views.py", li=
gunicorn stdout | ne 94, in get_context_data
gunicorn stdout |     for x in ADDONS.values()
gunicorn stdout |              ^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/weblate/utils/classloader.py=
gunicorn stdout | ", line 90, in values
gunicorn stdout |     return self.data.values()
gunicorn stdout |            ^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/django/utils/functional.py",=
gunicorn stdout |  line 47, in __get__
gunicorn stdout |     res =3D instance.__dict__[self.name] =3D self.func(instance)
gunicorn stdout |                                          ^^^^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/weblate/utils/classloader.py=
gunicorn stdout | ", line 72, in data
gunicorn stdout |     return self.load_data()
gunicorn stdout |            ^^^^^^^^^^^^^^^^
gunicorn stdout |   File "/app/venv/lib/python3.12/site-packages/weblate/utils/classloader.py=
gunicorn stdout | ", line 67, in load_data
gunicorn stdout |     result[obj.get_identifier()] =3D obj
gunicorn stdout |            ^^^^^^^^^^^^^^^^^^
gunicorn stdout | 
gunicorn stdout | Exception Type: AttributeError at /manage/addons/
gunicorn stdout | Exception Value: module 'weblate.gitexport' has no attribute 'get_identifie=
gunicorn stdout | r'
gunicorn stdout | Raised during: weblate.addons.views.AddonList
gunicorn stdout | Request information: <redacted>

How do you run Weblate?

Docker container

Weblate versions

Weblate deploy checks

System check identified some issues:

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/weblate-5.6.1/admin/install.html#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/weblate-5.6.1/admin/backup.html

System check identified 2 issues (1 silenced).

Additional context

No response

nijel commented 3 months ago

The Git exporter is not an add-on, adding it to WEBLATE_ADD_ADDONS is not supposed to work, please remove it. The Docker container has already turned that on.

mkstephenson commented 3 months ago

Ahh ok, thanks! I couldn't find anything in the docs about it being turned on by default (https://docs.weblate.org/en/latest/admin/optionals.html#git-exporter) so I assumed I needed to turn it on and since I couldn't figure out where else to enable it, I (incorrectly) added it here.

Should I close the issue or would you like to keep it open to track the internal server error?

nijel commented 3 months ago

I've updated the docs in https://github.com/WeblateOrg/weblate/commit/95a9de9ed77f0d51a97c22d5cb8b959765977637 and let's keep this issue open until https://github.com/WeblateOrg/weblate/pull/11977 is merged, which will make the error message easier to understand.

github-actions[bot] commented 3 months ago

Thank you for your report; the issue you have reported has just been fixed.

github-actions[bot] commented 3 months ago

Thank you for your report; the issue you have reported has just been fixed.