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

TypeError at /user/xxxx for non-admin visitor #10591

Closed
2 tasks done
mig5 opened this issue Dec 12, 2023 · 2 comments
Closed
2 tasks done

TypeError at /user/xxxx for non-admin visitor #10591

mig5 opened this issue Dec 12, 2023 · 2 comments
Assignees
Labels
bug Something is broken.
Milestone

Comments

@mig5
Copy link

mig5 commented Dec 12, 2023

Describe the issue

My weblate instance just reported a series of Internal Server Errors, all when viewing a user profile at /user/xxxxx/

I reproduced the issue both as an unauthenticated user, as well as as a non-administrative, authenticated user. My user account is not the same as the one that occurred in the error.

As an administrator user, I can view the /user/xxxxx/ in question, without errors.

I can't seem to find other user accounts that see the same issue - it's always the same user account in question.

I have tried to change other users to have the same group memberships as this user, but it doesn't occur for them. And vice versa - I've tried to modify the affected user's groups/permissions, but it hasn't helped.

The user whose profile is affected, happens to be a Super Admin, and is a member of two other groups ('Users' and a custom group). But I can view other superadmins just fine even as an unauthenticated user, so it's not that..

I can't spot in the database what the difference is with this user. I wondered if you might be able to point me in the right direction as to what to look for?

I already tried

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

Steps to reproduce the behavior

Visit the affected account at /user/xxxxx as an anonymous or non-admin user

Expected behavior

Not get an error and see the user's profile

Screenshots

Screenshot_2023-12-12_15-27-49

Exception traceback

Internal Server Error: /user/xxxxx/

TypeError at /user/xxxxx/
Permission project.permissions does not support: <class 'NoneType'>: None

Request Method: GET
Request URL: https://weblate.xxxxxxx.xxxxxxxx/user/xxxxx/
Django Version: 4.2.7
Python Executable: /usr/local/bin/python
Python Version: 3.11.5
Python Path: ['/', '/usr/local/lib/python3.11/site-packages/git/ext/gitdb', '/', '/usr/local/bin', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', '/usr/local/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages', '/app/data/python']
Server time: Tue, 12 Dec 2023 03:16:50 +0000
Installed Applications:
['customize',
 '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']


Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 220, in _get_response
    response = response.render()
               ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/response.py", line 114, in render
    self.content = self.rendered_content
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/response.py", line 92, in rendered_content
    return template.render(context, self._request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/loader_tags.py", line 157, in render
    return compiled_parent._render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/loader_tags.py", line 63, in render
    result = block.nodelist.render(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 541, in render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 238, in render
    nodelist.append(node.render_annotated(context))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 321, in render
    return nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 321, in render
    return nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/template/library.py", line 237, in render
    output = self.func(*resolved_args, **resolved_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weblate/auth/templatetags/permissions.py", line 16, in perm
    return user.has_perm(permission, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weblate/auth/models.py", line 546, in has_perm
    return check_permission(self, perm, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weblate/auth/permissions.py", line 104, in check_permission
    raise TypeError(
    ^

Exception Type: TypeError at /user/xxxxx/
Exception Value: Permission project.permissions does not support: <class 'NoneType'>: None
Raised during: weblate.accounts.views.UserPage
Request information:


GET: No GET data

POST: No POST data

FILES: No FILES data

COOKIES: No cookie data

META:
HTTP_ACCEPT = '*/*'
HTTP_ACCEPT_ENCODING = 'gzip'
HTTP_CDN_LOOP = 'cloudflare'
HTTP_CF_CONNECTING_IP = 'YY.YY.YY.YY'
HTTP_CF_IPCOUNTRY = 'US'
HTTP_CF_RAY = '8342cf84dd92e84f-EWR'
HTTP_CF_VISITOR = '{"scheme":"https"}'
HTTP_CONNECTION = 'close'
HTTP_HOST = 'weblate.xxxxxxx.xxxxxxxx'
HTTP_USER_AGENT = 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)'
HTTP_X_FORWARDED_FOR = 'YY.YY.YY.YY, ZZ.ZZ.ZZ.ZZ'
HTTP_X_FORWARDED_PROTO = 'https'
HTTP_X_REAL_IP = 'ZZ.ZZ.ZZ.ZZ'
PATH_INFO = '/user/xxxxx/'
QUERY_STRING = ''
RAW_URI = '/user/xxxxx/'
REMOTE_ADDR = 'YY.YY.YY.YY'
REQUEST_METHOD = 'GET'
SCRIPT_NAME = ''
SERVER_NAME = 'weblate.xxxxxxxx.xxxxxxx'
SERVER_PORT = '443'
SERVER_PROTOCOL = 'HTTP/1.0'
SERVER_SOFTWARE = 'gunicorn/21.2.0'
WEBLATE_LANGUAGE = ''
WEBLATE_USER = "'anonymous'"
WEBLATE_VERSION:Cython = '3.0.5'
WEBLATE_VERSION:Django = '4.2.7'
WEBLATE_VERSION:Git = '2.39.2'
WEBLATE_VERSION:GitPython = '3.1.40'
WEBLATE_VERSION:Mercurial = '6.5.2'
WEBLATE_VERSION:Pillow = '10.1.0'
WEBLATE_VERSION:PostgreSQL server = '13.13'
WEBLATE_VERSION:PyGObject = '3.46.0'
WEBLATE_VERSION:Python = '3.11.5'
WEBLATE_VERSION:Weblate = '5.1.1'
WEBLATE_VERSION:aeidon = '1.13'
WEBLATE_VERSION:ahocorasick_rs = '0.20.0'
WEBLATE_VERSION:borgbackup = '1.2.6'
WEBLATE_VERSION:boto3 = '1.28.77'
WEBLATE_VERSION:celery = '5.3.4'
WEBLATE_VERSION:charset-normalizer = '3.3.2'
WEBLATE_VERSION:diff-match-patch = '20230430'
WEBLATE_VERSION:django-appconf = '1.0.5'
WEBLATE_VERSION:django-celery-beat = '2.5.0'
WEBLATE_VERSION:django-compressor = '4.4'
WEBLATE_VERSION:django-crispy-forms = '2.1'
WEBLATE_VERSION:django-filter = '23.3'
WEBLATE_VERSION:django-redis = '5.4.0'
WEBLATE_VERSION:djangorestframework = '3.14.0'
WEBLATE_VERSION:filelock = '3.13.1'
WEBLATE_VERSION:git-review = '2.3.1'
WEBLATE_VERSION:git-svn = '2.39.2'
WEBLATE_VERSION:hiredis = '2.2.3'
WEBLATE_VERSION:html2text = '2020.1.16'
WEBLATE_VERSION:iniparse = '0.5'
WEBLATE_VERSION:kombu = '5.3.2'
WEBLATE_VERSION:lxml = '4.9.3'
WEBLATE_VERSION:misaka = '2.1.1'
WEBLATE_VERSION:mysqlclient = '2.2.0'
WEBLATE_VERSION:nh3 = '0.2.14'
WEBLATE_VERSION:oauthlib = '3.2.2'
WEBLATE_VERSION:openpyxl = '3.1.2'
WEBLATE_VERSION:phply = '1.2.6'
WEBLATE_VERSION:psycopg2 = '2.9.9'
WEBLATE_VERSION:pycairo = '1.25.1'
WEBLATE_VERSION:pyparsing = '3.1.1'
WEBLATE_VERSION:python-dateutil = '2.8.2'
WEBLATE_VERSION:python-redis-lock = '4.0.0'
WEBLATE_VERSION:rapidfuzz = '********************'
WEBLATE_VERSION:requests = '2.31.0'
WEBLATE_VERSION:ruamel.yaml = '0.18.5'
WEBLATE_VERSION:sentry-sdk = '1.34.0'
WEBLATE_VERSION:siphashc = '2.3'
WEBLATE_VERSION:social-auth-app-django = '5.4.0'
WEBLATE_VERSION:social-auth-core = '4.5.0'
WEBLATE_VERSION:tesserocr = '2.6.2'
WEBLATE_VERSION:translate-toolkit = '3.10.1'
WEBLATE_VERSION:translation-finder = '2.15'
WEBLATE_VERSION:user-agents = '2.2.0'
WEBLATE_VERSION:weblate-language-data = '2023.5'
WEBLATE_VERSION:zeep = '4.2.1'
gunicorn.socket = <socket.socket fd=9, family=1, type=1, proto=0, laddr=/run/gunicorn/app/weblate/socket>
wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f6268bb7f10>
wsgi.file_wrapper = <class 'gunicorn.http.wsgi.FileWrapper'>
wsgi.input = <gunicorn.http.body.Body object at 0x7f62685c1c10>
wsgi.input_terminated = True
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'https'
wsgi.version = '(1, 0)'

(I can provide more of the 'settings' but was uncomfortable doing so in a public issue)



### How do you run Weblate?

Docker container

### Weblate versions

 * Weblate: 5.1.1
 * Django: 4.2.7
 * siphashc: 2.3
 * translate-toolkit: 3.10.1
 * lxml: 4.9.3
 * Pillow: 10.1.0
 * nh3: 0.2.14
 * python-dateutil: 2.8.2
 * social-auth-core: 4.5.0
 * 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.13.1
 * rapidfuzz: 3.4.0
 * openpyxl: 3.1.2
 * celery: 5.3.4
 * django-celery-beat: 2.5.0
 * kombu: 5.3.2
 * 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.34.0
 * Cython: 3.0.5
 * 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.2
 * Python: 3.11.5
 * Git: 2.39.2
 * psycopg2: 2.9.9
 * phply: 1.2.6
 * ruamel.yaml: 0.18.5
 * tesserocr: 2.6.2
 * boto3: 1.28.77
 * zeep: 4.2.1
 * aeidon: 1.13
 * iniparse: 0.5
 * mysqlclient: 2.2.0
 * Mercurial: 6.5.2
 * git-svn: 2.39.2
 * git-review: 2.3.1
 * PostgreSQL server: 13.13
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.smtp.EmailBackend: xxxx.xxxx.xxxx
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://localhost:6379/1, redis://localhost:6379/1, regular
 * Platform: Linux 5.10.0-26-amd64 (x86_64)

### Weblate deploy checks

```shell
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.1.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.1.1/admin/backup.html
?: (weblate.I031) New Weblate version is available, please upgrade to 5.2.1.
	HINT: https://docs.weblate.org/en/weblate-5.1.1/admin/upgrade.html

System check identified 3 issues (1 silenced).

Additional context

I have a staging instance running the same Weblate version, and the same user exists in that database. However, I can view that user's profile without triggering the error. This makes me feel that it is not specific to running Weblate 5.1.1 even though it is slightly older.

@nijel nijel self-assigned this Dec 12, 2023
@nijel nijel added the bug Something is broken. label Dec 12, 2023
@nijel nijel added this to the 5.2 milestone Dec 12, 2023
@nijel
Copy link
Member

nijel commented Dec 12, 2023

Please upgrade, this has been already fixed in 2e8a7e4.

@nijel nijel closed this as completed Dec 12, 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.

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

2 participants