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

Exception when both Project + Component is selected in groups #7296

Closed
ghubz opened this issue Feb 24, 2022 · 2 comments
Closed

Exception when both Project + Component is selected in groups #7296

ghubz opened this issue Feb 24, 2022 · 2 comments
Assignees
Labels
bug Something is broken.
Milestone

Comments

@ghubz
Copy link

ghubz commented Feb 24, 2022

Describe the issue

When editing a group, if you select both a Project and a Component then the following exception is given

Exception Type:	ValueError
Exception Value: 'GroupForm' has no field named 'project'.
Exception Location:	/home/weblate/weblate-env/lib/python3.7/site-packages/django/forms/forms.py, line 344, in add_error
Python Executable:	/usr/bin/uwsgi-core
Python Version:	3.7.3
Python Path:	
['/',
 '/home/weblate/weblate-env/lib/python3.7/site-packages/git/ext/gitdb',
 '.',
 '',
 '/home/weblate/weblate-env/lib/python37.zip',
 '/home/weblate/weblate-env/lib/python3.7',
 '/home/weblate/weblate-env/lib/python3.7/lib-dynload',
 '/usr/lib/python3.7',
 '/home/weblate/weblate-env/lib/python3.7/site-packages',
 '/home/weblate/weblate-env/lib/python3.7/site-packages/gitdb/ext/smmap']```


{project: [ValidationError(['This is not used when a component is selected.'])]}
Unhandled 'GroupForm' has no field named 'project'.


### I already tried

- [X] I've read and searched [the documentation](https://docs.weblate.org/).
- [X] I've searched for similar issues in this repository.

### Steps to reproduce the behavior

1. Create a new group or edit an existing one
2. Select a project from the list
3. Select a component from the list (doesn't matter if it's under that project or another)

### Expected behavior

It is expected to either get a user friendly error in case that is not supported or save successfully. 

You should be able to allow access to specific Projects and Components. One might want to grant access to Project A but only component X of Project B. Now this doesn't seem to be possible.

### Screenshots

_No response_

### Exception traceback

```pytb
ValidationError: {'project': ['This is not used when a component is selected.']}
  File "django/forms/forms.py", line 400, in _clean_form
    cleaned_data = self.clean()
  File "weblate/auth/admin.py", line 211, in clean
    {"project": _("This is not used when a component is selected.")}
ValueError: 'GroupForm' has no field named 'project'.
  File "django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/contrib/admin/options.py", line 616, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/sites.py", line 232, in inner
    return view(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 1660, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 1540, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "django/contrib/admin/options.py", line 1579, in _changeform_view
    form_validated = form.is_valid()
  File "django/forms/forms.py", line 175, in is_valid
    return self.is_bound and not self.errors
  File "django/forms/forms.py", line 170, in errors
    self.full_clean()
  File "django/forms/forms.py", line 373, in full_clean
    self._clean_form()
  File "django/forms/forms.py", line 402, in _clean_form
    self.add_error(None, e)
  File "django/forms/forms.py", line 344, in add_error
    "'%s' has no field named '%s'." % (self.__class__.__name__, field))

How do you run Weblate?

PyPI module

Weblate versions

  • Weblate: 4.10
  • Django: 3.2.10
  • siphashc: 2.1
  • translate-toolkit: 3.5.1
  • lxml: 4.7.1
  • Pillow: 8.4.0
  • bleach: 4.1.0
  • python-dateutil: 2.8.2
  • social-auth-core: 4.1.0
  • social-auth-app-django: 5.0.0
  • django-crispy-forms: 1.13.0
  • oauthlib: 3.1.0
  • django-compressor: 3.0
  • djangorestframework: 3.13.1
  • django-filter: 21.1
  • django-appconf: 1.0.5
  • user-agents: 2.2.0
  • filelock: 3.4.0
  • setuptools: 59.6.0
  • jellyfish: 0.8.9
  • openpyxl: 3.0.9
  • celery: 5.2.1
  • kombu: 5.2.2
  • translation-finder: 2.10
  • weblate-language-data: 2021.6
  • html2text: 2020.1.16
  • pycairo: 1.20.1
  • pygobject: 3.42.0
  • diff-match-patch: 20200713
  • requests: 2.26.0
  • django-redis: 5.1.0
  • hiredis: 2.0.0
  • sentry_sdk: 1.5.1
  • Cython: 0.29.26
  • misaka: 2.1.1
  • GitPython: 3.1.24
  • borgbackup: 1.1.17
  • pyparsing: 3.0.6
  • pyahocorasick: 1.4.2
  • python-redis-lock: 3.7.0
  • Python: 3.7.3
  • Git: 2.20.1
  • psycopg2-binary: 2.8.6
  • phply: 1.2.5
  • chardet: 4.0.0
  • ruamel.yaml: 0.17.4
  • tesserocr: 2.5.1
  • akismet: 1.1
  • boto3: 1.17.53
  • zeep: 4.0.0
  • aeidon: 1.9
  • iniparse: 0.5
  • Mercurial: 5.7.1
  • Redis server: 5.0.3
  • PostgreSQL server: 11.14
  • Database backends: django.db.backends.postgresql
  • 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 4.19.0-17-cloud-amd64 (x86_64)

Weblate deploy checks

WARNINGS:
?: (weblate.W025.fluent) Failure in loading handler for fluent file format: No module named 'fluent'
        HINT: https://docs.weblate.org/en/latest/admin/install.html#optional-deps
?: (weblate.W033.Gerrit) Failure in loading VCS module for Gerrit: git: 'review' is not a git command. See 'git --help'.
 (1)
        HINT: https://docs.weblate.org/en/latest/vcs.html
?: (weblate.W033.Subversion) Failure in loading VCS module for Subversion: git: 'svn' is not a git command. See 'git --help'.

Additional context

No response

@nijel nijel self-assigned this Feb 24, 2022
@nijel nijel added the bug Something is broken. label Feb 24, 2022
@nijel nijel added this to the 4.11 milestone Feb 24, 2022
@nijel
Copy link
Member

nijel commented Feb 24, 2022

Already fixed by 2d1319d

@nijel nijel closed this as completed Feb 24, 2022
@github-actions
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