Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weblate 5.2: server error on homepage if not logged-in #10439

Closed
2 tasks done
ldidry opened this issue Nov 20, 2023 · 4 comments
Closed
2 tasks done

Weblate 5.2: server error on homepage if not logged-in #10439

ldidry opened this issue Nov 20, 2023 · 4 comments
Assignees
Labels
bug Something is broken.
Milestone

Comments

@ldidry
Copy link

ldidry commented Nov 20, 2023

Describe the issue

I updated Weblate to 5.2 this morning and since, I have a 500 error when going on homepage if not logged-in.

I tracked the error and reverted the commit 805d708 to remove the error.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. be unlogged
  2. go to homepage
  3. instead of the list of projects, you got a server error message

Expected behavior

Get the list of projects and no server error message, obviously 😉

Screenshots

No response

Exception traceback

Environment:


Request Method: GET
Request URL: https://weblate.framasoft.org/

Django Version: 4.2.6
Python Version: 3.11.2
Installed Applications:
['weblate.addons',
 'weblate.auth',
 'weblate.checks',
 'weblate.formats',
 'weblate.glossary',
 'weblate.machinery',
 'weblate.trans',
 'weblate.lang',
 'weblate_language_data',
 'weblate.memory',
 'weblate.screenshots',
 'weblate.fonts',
 'weblate.accounts',
 'weblate.configuration',
 'weblate.utils',
 'weblate.vcs',
 'weblate.wladmin',
 'weblate.metrics',
 'weblate',
 'weblate.gitexport',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin.apps.SimpleAdminConfig',
 'django.contrib.admindocs',
 'django.contrib.sitemaps',
 'django.contrib.humanize',
 'social_django',
 'crispy_forms',
 'crispy_bootstrap3',
 'compressor',
 'rest_framework',
 'rest_framework.authtoken',
 'django_filters',
 'django_celery_beat',
 'corsheaders']
Installed Middleware:
['weblate.middleware.RedirectMiddleware',
 'weblate.middleware.ProxyMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'weblate.accounts.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'social_django.middleware.SocialAuthExceptionMiddleware',
 'weblate.accounts.middleware.RequireLoginMiddleware',
 'weblate.api.middleware.ThrottlingMiddleware',
 'weblate.middleware.SecurityMiddleware',
 'weblate.wladmin.middleware.ManageMiddleware']



Traceback (most recent call last):
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/trans/views/dashboard.py", line 172, in home
    return dashboard_anonymous(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/trans/views/dashboard.py", line 282, in dashboard_anonymous
    top_projects = sorted(
                   
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/trans/views/dashboard.py", line 284, in <lambda>
    key=lambda prj: -prj.stats.monthly_changes,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 237, in __getattr__
    self.calculate_by_name(name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 248, in calculate_by_name
    self.calculate_basic()
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 311, in calculate_basic
    self._calculate_basic()
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 1197, in _calculate_basic
    super()._calculate_basic()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 805, in _calculate_basic
    stats[item] = sum(values)
                  ^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 788, in <genexpr>
    values = (stats_obj.aggregate_get(item) for stats_obj in all_stats)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/weblate/weblate-env/lib/python3.11/site-packages/weblate/utils/stats.py", line 211, in aggregate_get
    return self._data[name]
           ^^^^^^^^^^^^^^^^

Exception Type: KeyError at /
Exception Value: 'unapproved_chars'

How do you run Weblate?

PyPI module

Weblate versions

  • Weblate: 5.2
  • Django: 4.2.6
  • siphashc: 2.3
  • translate-toolkit: 3.11.1
  • lxml: 4.9.3
  • Pillow: 10.1.0
  • nh3: 0.2.14
  • python-dateutil: 2.8.2
  • social-auth-core: 4.4.2
  • social-auth-app-django: 5.4.0
  • django-crispy-forms: 2.1
  • oauthlib: 3.2.2
  • django-compressor: 4.4
  • djangorestframework: 3.14.0
  • django-filter: 23.3
  • django-appconf: 1.0.5
  • user-agents: 2.2.0 * filelock: 3.12.4
  • rapidfuzz: 3.4.0
  • openpyxl: 3.1.2
  • celery: 5.3.5
  • django-celery-beat: 2.5.0
  • kombu: 5.3.4
  • translation-finder: 2.15
  • weblate-language-data: 2023.5
  • html2text: 2020.1.16
  • pycairo: 1.25.1
  • PyGObject: 3.46.0
  • diff-match-patch: 20230430
  • requests: 2.31.0
  • django-redis: 5.4.0
  • hiredis: 2.2.3
  • sentry-sdk: 1.31.0
  • Cython: 3.0.4
  • misaka: 2.1.1
  • GitPython: 3.1.40
  • borgbackup: 1.2.6
  • pyparsing: 3.1.1
  • ahocorasick_rs: 0.20.0
  • python-redis-lock: 4.0.0
  • charset-normalizer: 3.3.1
  • Python: 3.11.2
  • Git: 2.39.2
  • psycopg: 3.1.12
  • psycopg-binary: 3.1.12
  • phply: 1.2.6
  • ruamel.yaml: 0.18.2
  • tesserocr: 2.6.2
  • boto3: 1.28.71
  • zeep: 4.2.1
  • aeidon: 1.13
  • iniparse: 0.5
  • Mercurial: 6.5.2
  • git-svn: 2.39.2
  • git-review: 2.3.1
  • PostgreSQL server: 15.5
  • Database backends: django.db.backends.postgresql
  • PostgreSQL implementation: psycopg3 (binary)
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.EmailBackend: localhost
  • OS encoding: filesystem=utf-8, default=utf-8
  • Celery: redis://localhost:6379, redis://localhost:6379, regular
  • Platform: Linux 6.1.0-13-amd64 (x86_64)

Weblate deploy checks

System check identified some issues:

INFOS:
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
        HINT: https://docs.weblate.org/fr/weblate-5.2/admin/backup.html

System check identified 1 issue (1 silenced).

Additional context

No response

@nijel
Copy link
Member

nijel commented Nov 20, 2023

This can happen if there are statistics calculated before 5.1. We should probably have a migration path for such cases.

@nijel nijel added the bug Something is broken. label Nov 20, 2023
@nijel nijel added this to the 5.3 milestone Nov 20, 2023
@MAGICCC
Copy link

MAGICCC commented Nov 21, 2023

Indeed, have the same issue, thanks for checking!

@nijel nijel modified the milestones: 5.3, 5.2.1 Nov 22, 2023
@nijel nijel closed this as completed in 872f989 Nov 22, 2023
Copy link

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

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@nijel nijel self-assigned this Nov 22, 2023
@ldidry
Copy link
Author

ldidry commented Nov 22, 2023

Thx for the fix, it works well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

No branches or pull requests

3 participants